码迷,mamicode.com
首页 > 其他好文 > 详细

vue父组件向子组件传递数据

时间:2017-08-12 11:51:06      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:child   sel   import   creat   round   code   vue   one   class   

父组件
<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父组件向子组件传递数据

标签:child   sel   import   creat   round   code   vue   one   class   

原文地址:http://www.cnblogs.com/norm/p/7349567.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!