1 /~~父组件 runshow.vue~~/ 2 3 <template> 4 <div> 5 <conditions :fenxiConditonsList="propConditonsList"></conditions> 6 </div> 7 </template> 8 9 <script> 10 import conditions from './conditions.vue' 11 export default { 12 name:"runshow", 13 components: { 14 conditions 15 }, 16 data() { 17 return { 18 propConditonsList:{name:"小明"} 19 } 20 21 } 22 </script> 23 24 25 26 /~~子组件 conditions.vue ~~/ 27 <template> 28 <div> 29 <span>{{ataList }}</span> 30 </div> 31 </template> 32 <script> 33 export default{ 34 name:'conditions', 35 props:{ 36 fenxiConditonsList:{} 37 }, 38 data(){ 39 return{ 40 ataList:{} 41 } 42 }, 43 mounted(){ 44 this.ataList = that.fenxiConditonsList; 45 console.log(this.ataList); //打印 :{name:"小明"}
46 }
</script>
vue props父组件与子组件传值方法
猜你喜欢
转载自www.cnblogs.com/ajaxlu/p/9232825.html
今日推荐
周排行