1.el-select开启 filterable
2.filter-method 自定义筛选方法
3.dataFilter
dataFilter(value) { if (value) { //val存在 this.options2 = this.options.filter((item) => { if ( !!~item.name.indexOf(value) || !!~item.name.toUpperCase().indexOf(value.toUpperCase()) || !!~item.code.indexOf(value) || !!~item.code.toUpperCase().indexOf(value.toUpperCase()) ) { return true; } }); } else { //val为空时,还原数组 this.options2 = this.options; } },
options2为需要房子el-select下面的el-option使用
options为用来filter的数组
options2和options值一样