ci: 集成 pinia 提供主题持久化

This commit is contained in:
就眠儀式
2022-04-06 00:24:20 +08:00
parent 0f7d25bc09
commit ae75cffa9b
5 changed files with 28 additions and 29 deletions

View File

@@ -1,10 +1,10 @@
import { defineStore } from 'pinia'
import { defineStore } from "pinia";
export const useAppStore = defineStore({
id: 'app',
id: "app",
state: () => {
return {
theme: 'light',
theme: "light",
themeVariable: {
"--global-primary-color": "#009688",
"--global-normal-color": "#1e9fff",
@@ -21,24 +21,21 @@ export const useAppStore = defineStore({
"--global-neutral-color-7": "#cccccc",
"--global-neutral-color-8": "#c2c2c2",
},
}
},
getters: {
},
actions: {
};
},
getters: {},
actions: {},
persist: {
enabled: true,
strategies: [
{
key: 'theme',
storage: localStorage
},{
key: 'themeVariable',
storage: localStorage
}
]
}
})
enabled: true,
strategies: [
{
key: "theme",
storage: localStorage,
},
{
key: "themeVariable",
storage: localStorage,
},
],
},
});

View File

@@ -1,7 +1,7 @@
import { createPinia } from 'pinia'
import piniaPluginPersist from 'pinia-plugin-persist'
import { createPinia } from "pinia";
import piniaPluginPersist from "pinia-plugin-persist";
const store = createPinia();
store.use(piniaPluginPersist);
export default store;
export default store;