Browse Source

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

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

19
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();
}
@ -982,7 +993,7 @@ router.beforeEach((to, from, next) => {
});
return next({
name: "login",
query: { redirect: to.fullPath }
query: { redirect: to.fullPath }
});
}
window.SITE_CONFIG["menuShujuList"] = res.data;
@ -996,7 +1007,7 @@ router.beforeEach((to, from, next) => {
console.log(err);
next({
name: "login",
query: { redirect: to.fullPath }
query: { redirect: to.fullPath }
});
});
http
@ -1013,7 +1024,7 @@ router.beforeEach((to, from, next) => {
});
return next({
name: "login",
query: { redirect: to.fullPath }
query: { redirect: to.fullPath }
});
}
window.SITE_CONFIG["menuList"] = res.data
@ -1031,7 +1042,7 @@ router.beforeEach((to, from, next) => {
console.log(err);
next({
name: "login",
query: { redirect: to.fullPath }
query: { redirect: to.fullPath }
});
});
});

Loading…
Cancel
Save