第一个数字 public getLevel(val) { let str = ""; this.dictionary.ScoreStatus.forEach((element) => { if (element.value === Number(val)) { str = element.label; } }); return str; }
第二种情况2个数字还是3个数字 private setFilterData(str, dictionary) { const newArr = str.split(","); if (!Array.isArray(newArr)) return "-"; const res = newArr.map((item, index) => { return ( this.filterDictionary({ value: Number(item), dictionary: dictionary, }) || "-" ); }); return res.toString(); } 用法: <template #column-industryCode="{ row }">