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