feat: 集成tags多标签功能
This commit is contained in:
22
src/store/modules/tag.js
Normal file
22
src/store/modules/tag.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useTagStore = defineStore('tag', {
|
||||
state() {
|
||||
return {
|
||||
tags: [],
|
||||
activeTag: '',
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setActiveTag(path) {
|
||||
this.activeTag = path
|
||||
},
|
||||
addTag(tag = {}) {
|
||||
if (this.tags.some((item) => item.path === tag.path)) return
|
||||
this.tags.push(tag)
|
||||
},
|
||||
removeTag(path) {
|
||||
this.tags = this.tags.filter((tag) => tag.path !== path)
|
||||
},
|
||||
},
|
||||
})
|
17
src/store/modules/theme/index.js
Normal file
17
src/store/modules/theme/index.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useThemeStore = defineStore('theme', {
|
||||
state() {
|
||||
return {
|
||||
tag: {
|
||||
visible: true,
|
||||
height: 50,
|
||||
},
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setTabVisible(visible) {
|
||||
this.tag.visible = visible
|
||||
},
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user