vue中<router-view />中的组件调用父组件的方法
把它当一个不普通的子组件使用就行了。
1.父组件调用子组件中的方法
<div>
<input type="button" @click="handleChildMethod"/><router-view ref="child" />
</div>
...
methods:{fatherMethod(){...},handleChildMethod(){this.$refs['child'].childMethod()}
}
2. 子组件调用父组件
<input type="button" @click="handleFatherMethod"/>
...
methods:{handleFatherMethod(){this.$parent.fatherMethod()}
}