We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
单向数据流
所有的prop都使得其父子之间形成了一个单向下行绑定:父级prop的更新会向下流动到子组件中,但是反过来则不行。 防止从子组件意外变更父级组件的状态,从而导致应用中的数据流难以理解。
每次父级组件发生变更时,子组件中所有的prop都将会刷新为最新的值。不能在一个子组件内部改变prop。
两种常见的试图变更一个prop的情形:
props: ['initialCounter'], data: function () { return { counter: this.initialCounter } }
props: ['size'], computed: { normalizedSize: function () { return this.size.trim().toLowerCase() } }
The text was updated successfully, but these errors were encountered:
data中的属性为什么是一个function?
一个组件的data选项必须是一个函数,因此每个实例可以维护一份被返回对象的独立的拷贝。
Sorry, something went wrong.
No branches or pull requests
单向数据流
所有的prop都使得其父子之间形成了一个单向下行绑定:父级prop的更新会向下流动到子组件中,但是反过来则不行。
防止从子组件意外变更父级组件的状态,从而导致应用中的数据流难以理解。
每次父级组件发生变更时,子组件中所有的prop都将会刷新为最新的值。不能在一个子组件内部改变prop。
两种常见的试图变更一个prop的情形:
The text was updated successfully, but these errors were encountered: