fix: uncleared history (#354)

This commit is contained in:
YangFong 2024-08-25 16:29:44 +08:00 committed by GitHub
parent 1904ab492a
commit 832360419c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -139,16 +139,20 @@ export const useStore = defineStore(`store`, () => {
// 自定义 CSS 内容 // 自定义 CSS 内容
const cssContent = useStorage(`__css_content`, DEFAULT_CSS_CONTENT) const cssContent = useStorage(`__css_content`, DEFAULT_CSS_CONTENT)
const cssContentConfig = useStorage(addPrefix(`css_content_config`), { const cssContentConfig = useStorage(addPrefix(`css_content_config`), {
active: `方案 1`, active: `方案1`,
tabs: [ tabs: [
{ {
title: `方案 1`, title: `方案1`,
name: `方案 1`, name: `方案1`,
// 兼容之前的方案 // 兼容之前的方案
content: cssContent.value || DEFAULT_CSS_CONTENT, content: cssContent.value || DEFAULT_CSS_CONTENT,
}, },
], ],
}) })
onMounted(() => {
// 清空过往历史记录
cssContent.value = ``
})
const getCurrentTab = () => cssContentConfig.value.tabs.find((tab) => { const getCurrentTab = () => cssContentConfig.value.tabs.find((tab) => {
return tab.name === cssContentConfig.value.active return tab.name === cssContentConfig.value.active
}) })