获取接口数据,根据固定对象,获取接口数据没有的对象
data是接口返回的数据,例如:['交流500kV','交流220kV']
let newData = [];
let newData2 = [];
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); } });
newData2 = [...new Set(newData)]; //数组去重
this.kvList = newData2.sort(); //数组排序