mod: 文件名模块修改

This commit is contained in:
张传龙
2022-04-11 22:12:00 +08:00
parent b3aa8147b1
commit 8c1191ece2
4 changed files with 21 additions and 17 deletions

View File

@@ -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)
},
},
})