uniapp+uView单选框多选框使用与模糊搜索
*可同时选择{{categoryMaxNum >= categoryList.length ? categoryList.length : categoryMaxNum}}项
:disabled="item.disabled" :checked="item.checked">
common.js文件公共方法
// 模糊搜索
export function fuzzyQuery(list, arrSelect, keyWord) {
var reg = new RegExp(keyWord.trim());
var arr = [];
for (var i = 0; i < list.length; i++) {
if (arrSelect.length) {
let find = arrSelect.find(res => {
return res.key == list[i].key
})
if (find) { //已经选中的数据
continue // 跳过本次循环,继续下?个循环
}
}
if (reg.test(list[i].value)) {
arr.push(list[i]);
}
}
return arr;
}