【更新】关闭多标签功能后,移除其他被缓存的标签

pull/98/head
小诺 2023-03-27 00:10:11 +08:00 committed by 俞宝山
parent 6a74374f71
commit cc8c7b1e07
2 changed files with 12 additions and 5 deletions

View File

@ -60,7 +60,7 @@
<script> <script>
import tool from '@/utils/tool' import tool from '@/utils/tool'
import XnContextMenu from '@/components/XnContextMenu/index.vue' import XnContextMenu from '@/components/XnContextMenu/index.vue'
import { iframeStore, keepAliveStore, viewTagsStore } from '@/store' import {globalStore, iframeStore, keepAliveStore, viewTagsStore} from '@/store'
import { mapState, mapActions } from 'pinia' import { mapState, mapActions } from 'pinia'
export default { export default {
@ -79,6 +79,7 @@
}, },
computed: { computed: {
...mapState(viewTagsStore, ['viewTags']), ...mapState(viewTagsStore, ['viewTags']),
...mapState(globalStore, ['layoutTagsOpen']),
tagList() { tagList() {
return this.viewTags return this.viewTags
} }
@ -86,6 +87,9 @@
watch: { watch: {
$route(to) { $route(to) {
this.addViewTags(to) this.addViewTags(to)
},
layoutTagsOpen() {
this.closeOtherCacheTabs()
} }
}, },
created() { created() {
@ -161,7 +165,6 @@
// tag // tag
addViewTags(route) { addViewTags(route) {
this.activeKey = route.fullPath this.activeKey = route.fullPath
if (route.name && !route.meta.fullpage) { if (route.name && !route.meta.fullpage) {
this.pushViewTags(route) this.pushViewTags(route)
this.pushKeepLive(route.name) this.pushKeepLive(route.name)
@ -241,6 +244,13 @@
} }
}) })
}, },
//
closeOtherCacheTabs () {
const tags = [...this.tagList]
tags.forEach((tag) => {
this.closeSelectedTag(tag, false)
})
},
// TAB // TAB
maximize() { maximize() {
this.contextMenuVisible = false this.contextMenuVisible = false

View File

@ -152,9 +152,6 @@
}, },
computed: { computed: {
...mapState(globalStore, ['sysBaseConfig']), ...mapState(globalStore, ['sysBaseConfig']),
// captchaOpen() {
// return this.sysBaseConfig.SNOWY_SYS_DEFAULT_CAPTCHA_OPEN === 'true'
// }
}, },
watch: { watch: {
'config.theme': function (val) { 'config.theme': function (val) {