|
@@ -21,6 +21,7 @@ |
|
@@ -21,6 +21,7 @@ |
|
21
|
<li @click="refreshSelectedTag(selectedTag)">刷新页面</li>
|
21
|
<li @click="refreshSelectedTag(selectedTag)">刷新页面</li>
|
|
22
|
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭当前</li>
|
22
|
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭当前</li>
|
|
23
|
<li @click="closeOthersTags">关闭其他</li>
|
23
|
<li @click="closeOthersTags">关闭其他</li>
|
|
|
|
24
|
+ <li v-if="!isLastView()" @click="closeRightTags">关闭右侧</li>
|
|
24
|
<li @click="closeAllTags(selectedTag)">关闭所有</li>
|
25
|
<li @click="closeAllTags(selectedTag)">关闭所有</li>
|
|
25
|
</ul>
|
26
|
</ul>
|
|
26
|
</div>
|
27
|
</div>
|
|
@@ -83,6 +84,13 @@ export default { |
|
@@ -83,6 +84,13 @@ export default { |
|
83
|
isAffix(tag) {
|
84
|
isAffix(tag) {
|
|
84
|
return tag.meta && tag.meta.affix
|
85
|
return tag.meta && tag.meta.affix
|
|
85
|
},
|
86
|
},
|
|
|
|
87
|
+ isLastView() {
|
|
|
|
88
|
+ try {
|
|
|
|
89
|
+ return this.selectedTag.fullPath === this.visitedViews[this.visitedViews.length - 1].fullPath
|
|
|
|
90
|
+ } catch (err) {
|
|
|
|
91
|
+ return false
|
|
|
|
92
|
+ }
|
|
|
|
93
|
+ },
|
|
86
|
filterAffixTags(routes, basePath = '/') {
|
94
|
filterAffixTags(routes, basePath = '/') {
|
|
87
|
let tags = []
|
95
|
let tags = []
|
|
88
|
routes.forEach(route => {
|
96
|
routes.forEach(route => {
|
|
@@ -152,6 +160,13 @@ export default { |
|
@@ -152,6 +160,13 @@ export default { |
|
152
|
}
|
160
|
}
|
|
153
|
})
|
161
|
})
|
|
154
|
},
|
162
|
},
|
|
|
|
163
|
+ closeRightTags() {
|
|
|
|
164
|
+ this.$store.dispatch('tagsView/delRightTags', this.selectedTag).then(visitedViews => {
|
|
|
|
165
|
+ if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
|
|
|
|
166
|
+ this.toLastView(visitedViews)
|
|
|
|
167
|
+ }
|
|
|
|
168
|
+ })
|
|
|
|
169
|
+ },
|
|
155
|
closeOthersTags() {
|
170
|
closeOthersTags() {
|
|
156
|
this.$router.push(this.selectedTag).catch(()=>{});
|
171
|
this.$router.push(this.selectedTag).catch(()=>{});
|
|
157
|
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
|
172
|
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
|