Commit 5ba0ac6a by lijiabin

【需求 17679】 feat: 加入全局变量等

parent 2c42431e
export * from './user'
export * from './tags'
......@@ -8,12 +8,22 @@ import { getTagList } from '@/api'
export const useTagsStore = defineStore('tags', () => {
const tagList = ref<{ label: string; value: number }[]>([])
let isLoading = false
const fetchTagList = async () => {
if (isLoading) return
isLoading = true
try {
const { data } = await getTagList()
tagList.value = data.map((item) => ({
label: item.title,
value: item.id,
}))
} catch (error) {
console.error(error)
} finally {
isLoading = false
}
}
return { tagList, fetchTagList }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment