Browse Source

add:如果判断路由为target=_blank,则用window.open()打开新页面

feature
wxz 11 months ago
parent
commit
0a87850bce
  1. 11
      src/router/index.js

11
src/router/index.js

@ -942,9 +942,20 @@ const router = new Router({
}),
routes: pageRoutes.concat(moduleRoutes, moduleShujuRoutes, dataBoardRoutes),
});
router.beforeEach((to, from, next) => {
// 添加动态(菜单)路由
// 已添加或者当前路由为页面路由, 可直接访问
let toUrl = to.meta.iframeURL
if (toUrl && toUrl.indexOf("target=_blank") != -1) {
// 此处请求后端,获取一个ticket票据
http.get("/auth/sso/getTicket")
.then(({data: res}) => {
let ticket = res.data
window.open(toUrl + ticket)
})
return null;
}
if (to.name === "caiji") {
return next();
}

Loading…
Cancel
Save