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
const Child = { template: '<span></span>', data () { return { childData: this.parentData } }, props: ['parentData'], created () { // 这里将输出 parent console.log(this.childData) } } var vm = new Vue({ el: '#app', // 通过 props 向子组件传递数据 template: '<child parent-data="parent" />', components: { Child } })
因为 inject 和 props 这两个选项的初始化是先于 data 选项的,这就保证了我们能够使用 props 初始化 data 中的数据
这样就保证了我们在 data 中使用props 中的值
props
由于 props 的初始化先于 data 选项的初始化 2、data 选项是在初始化的时候才求值的,你也可以理解为在初始化的时候才使用 mergeData 进行数据合并
The text was updated successfully, but these errors were encountered:
No branches or pull requests
因为 inject 和 props 这两个选项的初始化是先于 data 选项的,这就保证了我们能够使用 props 初始化 data 中的数据
这样就保证了我们在 data 中使用
props
中的值由于 props 的初始化先于 data 选项的初始化
2、data 选项是在初始化的时候才求值的,你也可以理解为在初始化的时候才使用 mergeData 进行数据合并
The text was updated successfully, but these errors were encountered: