首页 > Web开发 > 详细

Vuejs——组件——props数据传递

时间:2017-07-14 11:44:50      阅读:271      评论:0      收藏:0      [点我收藏+]

父组件向子组件传递:

wapper.vue父组件

<template>
  <div>
    <input type="text" v-model="msg">
    <br>
   <!--  将子控件属性inputValue与父组件msg属性绑定 -->
    <child :inputValue="msg"></child>
  </div>
</template>
<style>

</style>
<script>
  export default{
    data(){
      return {
        msg: 请输入
      }
    },
    components: {
      child: require(./Child.vue)
    }
  }
</script>
child.vue子组件
<template>
  <div>
    <p>{{inputValue}}</p>
  </div>
</template>
<style>

</style>
<script>
    export default{
        props: {
          inputValue: String
        }
    }
</script>

 

 

 

Vuejs——组件——props数据传递

原文:http://www.cnblogs.com/queenaq/p/7169144.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!