在父组件中通过provide
来提供变量,然后在子组件中通过inject
来注入变量
provide(){ return{ reload:this.reload } },
reload(){ this.isRouterAlive = false; this.$nextTick(function(){ this.isRouterAlive = true; }) }
inject:['reload'],
this.reload();
来源:https://www.cnblogs.com/1024L/p/12048118.html