父组件, 首先要挂载子组件
如果父组件传值给子组件, 则
- <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 事件
来源: http://www.bubuko.com/infodetail-3392925.html