使用真登录功能前拉取报错,提交代码

This commit is contained in:
GYYM
2024-11-20 11:22:05 +08:00
parent 963c0f5713
commit fdc7639887
19 changed files with 192 additions and 86 deletions

View File

@@ -13,6 +13,9 @@ export const useDictStore = defineStore({
}),
getters: {},
actions: {
setDictData(data: Dict[]) {
this.dictData = data
},
// 获取字典数据数组,如果为空则返回空数组
getDictData(code: string) {
if (!this.dictData.length) {

View File

@@ -0,0 +1,26 @@
// src/stores/modules/mode.ts
import { defineStore } from 'pinia';
// export const useModeStore = defineStore('mode', {
// state: () => ({
// currentMode: '' as string,
// }),
// actions: {
// setCurrentMode(modeName: string) {
// this.currentMode = modeName;
// },
// },
// });
export const useModeStore = defineStore('mode', {
state: () => ({
currentMode: localStorage.getItem('currentMode') || '' as string,
}),
actions: {
setCurrentMode(modeName: string) {
this.currentMode = modeName;
localStorage.setItem('currentMode', modeName); // 保存到 localStorage
},
},
});