这个数据无法使用map遍历吗?-灵析社区

正确计算方式

![image.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20250103/24077f83b31d855e552e4386c6a7c824.png) 定义的dacaData类 /** * @classdesc 字典数据 * @property {String} label 标签 * @property {*} value 标签 * @property {Object} raw 原始数据 */ export default class DictData { constructor(label, value, raw) { this.label = label this.value = value this.raw = raw } } 字典 /** * 加载字典 * @param {Dict} dict 字典 * @param {DictMeta} dictMeta 字典元数据 * @returns {Promise} */ function loadDict(dict, dictMeta) { return dictMeta.request(dictMeta).then((response) => { const type = dictMeta.type; let dicts = dictMeta.responseConverter(response, dictMeta); if (!(dicts instanceof Array)) { console.error("the return of responseConverter must be Array."); dicts = []; } else if ( dicts.filter((d) => d instanceof DictData).length !== dicts.length ) { console.error("the type of elements in dicts must be DictData"); dicts = []; } dict.type[type].splice(0, Number.MAX_SAFE_INTEGER, ...dicts); dicts.forEach((d) => { Vue.set(dict.label[type], d.value, d.label); }); return dicts; }); }

阅读量:21

点赞量:0

问AI
我只爱钱
一看就是若依那一套