chore: dict
This commit is contained in:
parent
cd526828b3
commit
3d16b67523
@ -63,7 +63,6 @@ export const useDictStore = defineStore('app-dict', () => {
|
||||
}
|
||||
|
||||
function resetCache() {
|
||||
dictRequestCache.clear();
|
||||
dictMap.clear();
|
||||
dictOptionsMap.clear();
|
||||
}
|
||||
@ -94,7 +93,9 @@ export const useDictStore = defineStore('app-dict', () => {
|
||||
}
|
||||
|
||||
function $reset() {
|
||||
resetCache();
|
||||
/**
|
||||
* doNothing
|
||||
*/
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -6,10 +6,14 @@ import { type Option, useDictStore } from '#/store/dict';
|
||||
// todo 重复代码的封装
|
||||
export function getDict(dictName: string): DictData[] {
|
||||
const { dictRequestCache, getDict, setDictInfo } = useDictStore();
|
||||
console.log('aaaaa');
|
||||
// 这里拿到
|
||||
const dictList = getDict(dictName);
|
||||
// 检查请求状态缓存
|
||||
if (dictList.length === 0 && !dictRequestCache.has(dictName)) {
|
||||
console.log('bbbb');
|
||||
console.log(dictList.length);
|
||||
console.log(dictRequestCache.has(dictName));
|
||||
dictRequestCache.set(
|
||||
dictName,
|
||||
dictDataInfo(dictName).then((resp) => {
|
||||
|
Loading…
Reference in New Issue
Block a user