提交 b8a36d05 作者: 方治民

fix: 修复顶级 await

上级 888440d5
...@@ -2,6 +2,7 @@ import { cascaderHn } from '/@/api/model/dict' ...@@ -2,6 +2,7 @@ import { cascaderHn } from '/@/api/model/dict'
const storageKey = 'app_dict_data_area_cascaderHn'; const storageKey = 'app_dict_data_area_cascaderHn';
let areaOptions = [];
export const getDictData = async () => { export const getDictData = async () => {
// 先从本地加载数据 // 先从本地加载数据
let dictData = getLocalDict(); let dictData = getLocalDict();
...@@ -12,6 +13,8 @@ export const getDictData = async () => { ...@@ -12,6 +13,8 @@ export const getDictData = async () => {
uni.setStorageSync(storageKey, data); uni.setStorageSync(storageKey, data);
dictData = JSON.parse(data); dictData = JSON.parse(data);
} }
areaOptions = dictData;
return dictData; return dictData;
} }
...@@ -36,8 +39,6 @@ export const refreshDictData = () => { ...@@ -36,8 +39,6 @@ export const refreshDictData = () => {
getDictData(); getDictData();
} }
const areaOptions = await getDictData();
export const getText = (scope: string, spliced: string) => { export const getText = (scope: string, spliced: string) => {
if (!scope || !areaOptions || areaOptions.length === 0) { if (!scope || !areaOptions || areaOptions.length === 0) {
return '' return ''
...@@ -72,4 +73,4 @@ export const getText = (scope: string, spliced: string) => { ...@@ -72,4 +73,4 @@ export const getText = (scope: string, spliced: string) => {
} else { } else {
return labels ? labels.join('') : '' return labels ? labels.join('') : ''
} }
} }
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论