ci: 集成 pinia 提供主题持久化
This commit is contained in:
parent
0f7d25bc09
commit
ae75cffa9b
@ -136,7 +136,9 @@
|
||||
></lay-color-picker
|
||||
>
|
||||
<lay-color-picker
|
||||
v-model="appStore.themeVariable['--global-dark-background-color']"
|
||||
v-model="
|
||||
appStore.themeVariable['--global-dark-background-color']
|
||||
"
|
||||
></lay-color-picker>
|
||||
|
||||
<lay-button fluid="true">导 出 配 置</lay-button>
|
||||
@ -272,7 +274,7 @@ export default {
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
menu.forEach((m) => {
|
||||
m.children.forEach((c) => {
|
||||
menus.push(c);
|
||||
|
@ -3,7 +3,7 @@ import { App, createApp as _createApp } from "vue";
|
||||
import { createRouter } from "./router/index";
|
||||
import { Router } from "vue-router";
|
||||
import layui from "@layui/layui-vue";
|
||||
import Store from './store';
|
||||
import Store from "./store";
|
||||
import "@layui/layui-vue/lib/index.css";
|
||||
import LayCode from "./components/LayCode.vue";
|
||||
import LaySearch from "./components/LaySearch.vue";
|
||||
|
@ -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,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
@ -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;
|
||||
|
@ -119,7 +119,7 @@ export default {
|
||||
setup() {
|
||||
const { t } = useI18n();
|
||||
const appStore = useAppStore();
|
||||
|
||||
|
||||
const changeTheme = () => {
|
||||
if (appStore.theme === "dark") {
|
||||
appStore.theme = "light";
|
||||
|
Loading…
Reference in New Issue
Block a user