页面a中有个按钮
只能根据url 参数处理
使用bus主线通信这两页面
跳转之前传递参数,初始化之前获取参数并判断
// 1、main.js
Vue.prototype.$bus = new Vue();
// 2、b页面created
this.$bus.$on("handleClick", this.onRefresh);
// 3、a页面需要调用的地方
this.$bus.$emit("handleClick");
注意页面销毁时移除自定义事件监听器
beforeDestroy() {
this.$bus.$off("handleClick");
}