|
@@ -54,12 +54,20 @@ export default {
|
|
|
//当路由变更时,执行打开页面的方法
|
|
|
$route: {
|
|
|
handler(v) {
|
|
|
- this.openPage(v);
|
|
|
+ let new_route = {};
|
|
|
+ for(let key in v){
|
|
|
+ new_route[key] = v[key];
|
|
|
+ }
|
|
|
+ new_route.t_name = this.t_name;
|
|
|
+
|
|
|
+ this.openPage(new_route);
|
|
|
},
|
|
|
immediate: true,
|
|
|
},
|
|
|
+
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.t_name = this.t_name;
|
|
|
//添加点击关闭右键菜单
|
|
|
window.addEventListener("click", this.closeContextMenu);
|
|
|
},
|
|
@@ -85,33 +93,28 @@ export default {
|
|
|
//打开页面
|
|
|
openPage(route) {
|
|
|
this.contextMenuTargetPageRoute = route;
|
|
|
- let new_route = {};
|
|
|
- for(let key in route){
|
|
|
- new_route[key] = route[key];
|
|
|
- }
|
|
|
- new_route.t_name = this.t_name;
|
|
|
- console.log(new_route)
|
|
|
- if (new_route.name == this.blankRouteName) {
|
|
|
+ if (route.name == this.blankRouteName) {
|
|
|
return;
|
|
|
}
|
|
|
let isExist = this.openedPageRouters.some(
|
|
|
- (item) => item.fullPath == new_route.fullPath
|
|
|
+ (item) => item.fullPath == route.fullPath
|
|
|
);
|
|
|
if (!isExist) {
|
|
|
let openedPageRoute = this.openedPageRouters.find(
|
|
|
- (item) => item.path == new_route.path
|
|
|
+ (item) => item.path == route.path
|
|
|
);
|
|
|
//判断页面是否支持不同参数多开页面功能,如果不支持且已存在path值一样的页面路由,那就替换它
|
|
|
- if (!new_route.meta.canMultipleOpen && openedPageRoute != null) {
|
|
|
+ if (!route.meta.canMultipleOpen && openedPageRoute != null) {
|
|
|
this.delRouteCache(openedPageRoute.fullPath);
|
|
|
this.openedPageRouters.splice(
|
|
|
this.openedPageRouters.indexOf(openedPageRoute),
|
|
|
1,
|
|
|
- new_route
|
|
|
+ route
|
|
|
);
|
|
|
} else {
|
|
|
- this.openedPageRouters.push(new_route);
|
|
|
+ this.openedPageRouters.push(route);
|
|
|
}
|
|
|
+ console.log(route)
|
|
|
this.bottomScrollClick();
|
|
|
}
|
|
|
},
|