投稿提示
This commit is contained in:
21
src/components/common/Redirect.vue
Normal file
21
src/components/common/Redirect.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
beforeCreate() {
|
||||
// 获取传递过来的路径和参数
|
||||
const { path, ...query } = this.$route.query;
|
||||
// 立即跳回原页面
|
||||
this.$router.replace({
|
||||
path: path,
|
||||
query: query
|
||||
});
|
||||
},
|
||||
// 渲染一个空节点
|
||||
render(h) {
|
||||
return h();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -65,6 +65,9 @@
|
||||
if(this.tagsList.length >= 8){
|
||||
this.tagsList.shift();
|
||||
}
|
||||
if(route.meta.hideInTags){
|
||||
return false;
|
||||
}
|
||||
this.tagsList.push({
|
||||
title: route.meta.title,
|
||||
path: route.fullPath,
|
||||
@@ -90,7 +93,9 @@
|
||||
created(){
|
||||
this.setTags(this.$route);
|
||||
// 监听关闭当前页面的标签页
|
||||
|
||||
bus.$on('close_current_tags', () => {
|
||||
console.log('出发关闭当前标签页');
|
||||
for (let i = 0, len = this.tagsList.length; i < len; i++) {
|
||||
const item = this.tagsList[i];
|
||||
if(item.path === this.$route.fullPath){
|
||||
@@ -106,7 +111,11 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
// beforeDestroy() {
|
||||
// // 销毁监听,防止内存泄漏
|
||||
// this.$bus.$off('close_current_tags');
|
||||
// }
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user