优化字典工具获取字典的取值

This commit is contained in:
aixianling
2022-08-09 09:50:30 +08:00
parent e8b8b4cdb7
commit fb0f5be2ef

View File

@@ -9,11 +9,13 @@ const $dict = {
this.url = config?.url || this.url
},
dicts() {
return uni.getStorageSync('dicts') || [];
let dicts = uni.getStorageSync('dicts')
typeof dicts == "string" ? (dicts = JSON.parse(dicts)) : dicts
return dicts || [];
},
load(...code) {
return this.instance && this.instance.post(this.url, null, {
withoutToken:true,
withoutToken: true,
params: {
codeList: code.toString()
}