|
@@ -5,7 +5,7 @@
|
|
|
<div class="mianscroll" ref="mianscroll">
|
|
|
<div class="__tabs">
|
|
|
<div class="__tab-item" v-for="item in openedPageRouters" :class="{'__is-active': item.fullPath == $route.fullPath,}" :key="item.fullPath" @click="onClick($event,item)" @contextmenu.prevent="showContextMenu($event, item)">
|
|
|
- {{ item.meta.title }} <span v-if="item.meta.xm">- {{ item.meta.xm }}</span>
|
|
|
+ {{ item.meta.title }} <span v-if="item.t_name">- {{ item.t_name }}</span>
|
|
|
<span class="el-icon-close" @click.stop="onClose(item)" @contextmenu.prevent.stop="" :style="openedPageRouters.length <= 1 ? 'width:0;' : ''"></span>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -38,6 +38,7 @@ export default {
|
|
|
type: String,
|
|
|
default: "blank",
|
|
|
}, //空白路由的name值
|
|
|
+ t_name:''
|
|
|
},
|
|
|
inject: ["reloads"],
|
|
|
data() {
|
|
@@ -84,26 +85,32 @@ export default {
|
|
|
//打开页面
|
|
|
openPage(route) {
|
|
|
this.contextMenuTargetPageRoute = route;
|
|
|
- if (route.name == this.blankRouteName) {
|
|
|
+ let new_route = {};
|
|
|
+ for(let key in route){
|
|
|
+ new_route[key] = route[key];
|
|
|
+ }
|
|
|
+ new_route.t_name = this.t_name;
|
|
|
+
|
|
|
+ if (new_route.name == this.blankRouteName) {
|
|
|
return;
|
|
|
}
|
|
|
let isExist = this.openedPageRouters.some(
|
|
|
- (item) => item.fullPath == route.fullPath
|
|
|
+ (item) => item.fullPath == new_route.fullPath
|
|
|
);
|
|
|
if (!isExist) {
|
|
|
let openedPageRoute = this.openedPageRouters.find(
|
|
|
- (item) => item.path == route.path
|
|
|
+ (item) => item.path == new_route.path
|
|
|
);
|
|
|
//判断页面是否支持不同参数多开页面功能,如果不支持且已存在path值一样的页面路由,那就替换它
|
|
|
- if (!route.meta.canMultipleOpen && openedPageRoute != null) {
|
|
|
+ if (!new_route.meta.canMultipleOpen && openedPageRoute != null) {
|
|
|
this.delRouteCache(openedPageRoute.fullPath);
|
|
|
this.openedPageRouters.splice(
|
|
|
this.openedPageRouters.indexOf(openedPageRoute),
|
|
|
1,
|
|
|
- route
|
|
|
+ new_route
|
|
|
);
|
|
|
} else {
|
|
|
- this.openedPageRouters.push(route);
|
|
|
+ this.openedPageRouters.push(new_route);
|
|
|
}
|
|
|
this.bottomScrollClick();
|
|
|
}
|
|
@@ -146,7 +153,6 @@ export default {
|
|
|
// this.$router.replace(this.contextMenuTargetPageRoute);
|
|
|
// });
|
|
|
this.reloads();
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
//关闭其他页面
|