1. 程式人生 > >vue父組件向子組件傳遞數據

vue父組件向子組件傳遞數據

rip pan ext sel name lan obj styles import

父組件
<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父組件向子組件傳遞數據