vue父组件向子组件传递数据
Posted layfork
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue父组件向子组件传递数据相关的知识,希望对你有一定的参考价值。
父组件 <template> <div id="app"> <v-header :childseller="fatherseller"></v-header> </div> </template> <script type="text/ecmascript-6"> import header from ‘components/header/header.vue‘; export default{ props: {}, data() { return { fatherseller:{ ‘name‘:‘mull‘, ‘phpne‘:‘18844413684‘ } } }, created() { }, methods: {}, components: { ‘v-header‘:header, }, computed: {} } </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style scoped lang="stylus" rel="stylesheet/stylus"> </style>
子组件 <template> <div id="header"> {{childseller.name}} </div> </template> <script type="text/ecmascript-6"> export default{ props: { childseller:Object }, data() { return {} }, created() { }, methods: {}, components: {}, computed: {} } </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style scoped lang="stylus" rel="stylesheet/stylus"> </style>
以上是关于vue父组件向子组件传递数据的主要内容,如果未能解决你的问题,请参考以下文章
Vue父组件向子组件传递方法(自定义方法)并且子组件向父组件传递数据