data是接口返回的数据,例如:['交流500kV','交流220kV']let newData = []; let newData2 = [];
newData2 = [...new Set(newData)]; //数组去重 this.kvList = newData2.sort(); //数组排序
const map = { 交流500kV: "500kV", 交流220kV: "220kV", 交流110kV: "110kV", 交流35kV: "35kV", 交流10kV: "10kV", "交流0.4kV": "0.4kV", }; Object.keys(map).forEach((i) => { const val = map[i]; if (data.includes(i)) { newData.remove(val); } else { newData.push(val); } });
标签:val,500kV,对象,接口,交流,获取,newData2,newData From: https://www.cnblogs.com/a973692898/p/17096203.html