vue页面跳转打开新的窗口
1.主页面里写入,可以在url里面拼接参数和tokenwindow.parent.postMessage({type:"iframe",id:"other_"+parseInt(Math.random()*100),title:"电路详情列表",// url:"https://www.baidu.com/s?ie=UTF-8&wd=baidu"url:CORE_CONFIG.DETAIL_
·
1.主页面里写入,可以在url里面拼接参数和token
window.parent.postMessage({
type:"iframe",
id:"other_"+parseInt(Math.random()*100),
title:"电路详情列表",
// url:"https://www.baidu.com/s?ie=UTF-8&wd=baidu"
url:CORE_CONFIG.DETAIL_URL+'?objectid=' + val.OBJECTID + '&x_token=' + getToken()
},"*");
2.定义一个js方法,用来接收传递得参数 getUrl()
export function getUrl(name = "x_token",complex = false) {
var reg = new RegExp("[^\?&]?" + encodeURI(name) + "=[^&]+");
var arr = window.location.href.match(reg);
if (arr != null) {
return complex ?
decodeURIComponent(arr[0].substring(arr[0].search("=") + 1)) :
decodeURI(arr[0].substring(arr[0].search("=") + 1));
}
return "";
}
3.准备要跳转的页面接收 直接用getUrl获取参数
getUrl("objectid")
更多推荐
已为社区贡献1条内容
所有评论(0)