name:路由 query:传递参数
const page2 = this.$router.resolve({name:'addHs',query:{hsCode:row.hsCode}});
var page = window.open(page2.href, 'OpenhsWindows')
创建一个定时器,监听page页面关闭事件,当页面关闭时关闭定时器 执行回调函数;
var loop = setInterval(function () {
if (page.closed) {
clearInterval(loop);
callback();
}
}, 1000);
监听父子页面消息传递-父页面代码
window.addEventListener("message",function(msg){
console.log(msg);
if(msg.data.type == "xxxxx"){
//执行方法
}
});
监听父子页面消息传递-子页面代码
window.opener.postMessage({type:"xxxxx",message:"传递消息"}, "*");