diff --git a/src/components/AppIcons/index.js b/src/components/AppIcons/index.js
index ea46f76..51a2608 100644
--- a/src/components/AppIcons/index.js
+++ b/src/components/AppIcons/index.js
@@ -8,5 +8,10 @@ export { default as IconLink } from '~icons/mdi/link-variant'
export { default as IconAlert } from '~icons/mdi/alert-circle-outline'
export { default as IconCircle } from '~icons/mdi/circle-outline'
export { default as IconMenu } from '~icons/mdi/menu'
+export { default as IconRefresh } from '~icons/mdi/refresh'
+export { default as IconClose } from '~icons/mdi/close'
+export { default as IconExpand } from '~icons/mdi/arrow-expand-horizontal'
+export { default as IconExpandLeft } from '~icons/mdi/arrow-expand-left'
+export { default as IconExpandRight } from '~icons/mdi/arrow-expand-right'
export { default as IconLogo } from './IconLogo.vue'
diff --git a/src/layout/components/tags/ContextMenu.vue b/src/layout/components/tags/ContextMenu.vue
new file mode 100644
index 0000000..97a9e9f
--- /dev/null
+++ b/src/layout/components/tags/ContextMenu.vue
@@ -0,0 +1,129 @@
+
+
+
+
+
+
diff --git a/src/layout/components/tags/index.vue b/src/layout/components/tags/index.vue
index df13f1b..f115886 100644
--- a/src/layout/components/tags/index.vue
+++ b/src/layout/components/tags/index.vue
@@ -2,56 +2,77 @@
{{ tag.title }}
+
diff --git a/src/store/modules/tags/index.js b/src/store/modules/tags/index.js
index 715a2f4..16be158 100644
--- a/src/store/modules/tags/index.js
+++ b/src/store/modules/tags/index.js
@@ -1,5 +1,6 @@
import { defineStore } from 'pinia'
import { tagsSS, activeTag, tags, WITHOUT_TAG_PATHS } from './helpers'
+import { router } from '@/router'
export const useTagsStore = defineStore('tag', {
state() {
@@ -13,14 +14,47 @@ export const useTagsStore = defineStore('tag', {
this.activeTag = path
tagsSS.set('activeTag', path)
},
+ setTags(tags) {
+ this.tags = tags
+ tagsSS.set('tags', tags)
+ },
addTag(tag = {}) {
+ this.setActiveTag(tag.path)
if (WITHOUT_TAG_PATHS.includes(tag.path) || this.tags.some((item) => item.path === tag.path)) return
- this.tags.push(tag)
- tagsSS.set('tags', this.tags)
+ this.setTags([...this.tags, tag])
},
removeTag(path) {
- this.tags = this.tags.filter((tag) => tag.path !== path)
- tagsSS.set('tags', this.tags)
+ if (path === this.activeTag) {
+ const activeIndex = this.tags.findIndex((item) => item.path === path)
+ if (activeIndex > 0) {
+ router.push(this.tags[activeIndex - 1].path)
+ } else {
+ router.push(this.tags[activeIndex + 1].path)
+ }
+ }
+ this.setTags(this.tags.filter((tag) => tag.path !== path))
+ },
+ removeOther(curPath = this.activeTag) {
+ this.setTags(this.tags.filter((tag) => tag.path === curPath))
+ if (curPath !== this.activeTag) {
+ router.push(this.tags[this.tags.length - 1].path)
+ }
+ },
+ removeLeft(curPath) {
+ const curIndex = this.tags.findIndex((item) => item.path === curPath)
+ const filterTags = this.tags.filter((item, index) => index >= curIndex)
+ this.setTags(filterTags)
+ if (!filterTags.find((item) => item.path === this.activeTag)) {
+ router.push(filterTags[filterTags.length - 1].path)
+ }
+ },
+ removeRight(curPath) {
+ const curIndex = this.tags.findIndex((item) => item.path === curPath)
+ const filterTags = this.tags.filter((item, index) => index <= curIndex)
+ this.setTags(filterTags)
+ if (!filterTags.find((item) => item.path === this.activeTag)) {
+ router.push(filterTags[filterTags.length - 1].path)
+ }
},
},
})