以后始终没注意到两个难题,是el-checkbox-group优先选择的次序是依照点选的多选框的次序,而并非依照多选框的排序次序。但他们不期望它的次序打乱,有甚么好的软件系统呢?
// checkboxList : checkbox的字符串,checkList选上统计数据的字符串
{{ item }}
上面本写手有三个计划:
1、再次次序
let checkboxList=[a,b,c]
let checkList=[c,a]
let newCheckLIst=checkList.sort((a, b) => {
return checkboxList.indexOf(a) - checkboxList.indexOf(b)
})
2、假如是根本无法次序的简化字等等的,就根本无法用checkbox的字符串展开filter,原都去过滤器与否在已选的字符串中
let checkboxList=[a,b,c]
let checkList=[c,a]
const newCheckLIst = checkboxList.filter(item => checkList.includes(item))