trim(str) {
return str.replace(/(^s*)|(s*$)/g, "");
}
转换数据格式
convertField(record) {
return {
code: record.label,
name: record.label,
ord: record.key
}
}
// 转换数组
reverseFieldInArray(data) {
return data.map((record) => {
if (Object.keys(record).length == 0) {
return {}
} else {
return {
key: record.ord,
label: record.name
}
}
})
}
//对象数组去重
let hash = {};
btnValue = resetValue.reduce((preVal, curVal) => {
hash[curVal.ord] ? '' : hash[curVal.ord] = true && preVal.push(curVal);
return preVal
}, [])