mod: 文件名模块修改
This commit is contained in:
@@ -1,22 +1,26 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { tagsSS, activeTag, tags } from './helpers'
|
||||
|
||||
export const useTagStore = defineStore('tag', {
|
||||
export const useTagsStore = defineStore('tag', {
|
||||
state() {
|
||||
return {
|
||||
tags: [],
|
||||
activeTag: '',
|
||||
tags: tags || [],
|
||||
activeTag: activeTag || '',
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setActiveTag(path) {
|
||||
this.activeTag = path
|
||||
tagsSS.set('activeTag', path)
|
||||
},
|
||||
addTag(tag = {}) {
|
||||
if (this.tags.some((item) => item.path === tag.path)) return
|
||||
this.tags.push(tag)
|
||||
tagsSS.set('tags', this.tags)
|
||||
},
|
||||
removeTag(path) {
|
||||
this.tags = this.tags.filter((tag) => tag.path !== path)
|
||||
tagsSS.set('tags', this.tags)
|
||||
},
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user