首页 > 其他 > 详细

Vue之父子组件之间的传值

时间:2020-01-23 09:57:32      阅读:85      评论:0      收藏:0      [点我收藏+]

父组件,首先要挂载子组件

如果父组件传值给子组件,则

<transition mode="out-in">

<router-view  :applyList=‘applyList‘  applyPath=‘flightBstrip‘></router-view>

</transition>
1.父组件挂载子组件的时候声明属性 applyList,applyPath.(applyList是变量,flightBstrip是字符串)
2.子组件用过  props:[‘applyList‘,‘applyPath‘], 调用父组件传过来的值
 
子组件传值
<router-view @select-bstrip-apply="selectBstripApply" ></router-view>
1.父组件挂载子组件的时候声明方法 select-bstrip-apply
2.父组件method中实现selectBstripApply方法
3.子组件中通过
this.$emit("select-bstrip-apply", this.result)来触发父组件中的绑定的select-bstrip-apply事件

Vue之父子组件之间的传值

原文:https://www.cnblogs.com/jiangshuai0915/p/12230219.html

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