我有这样一个ID列的桌子,
ID 1 2 3 4 5
当我输入值为1时,它会显示: ID 1
但是当我输入值为1,3时,它没有显示任何内容。
有人能帮我解决这个问题吗?谢谢。
这是我的过滤代码:
textFiltering(field: string, $event) {
if ($event.value) {
const value = $event.value;
this.source = this._master.filter(record => {
return record[field].toUpperCase().indexOf(value) > -1;
});
} else {
this.source = this._master;
}}
发布于 2017-11-02 04:20:19
在传递1,3时,需要将字符串拆分为数组1,3,并使用array.includes检查数组中是否存在元素。
https://stackoverflow.com/questions/47067538
复制相似问题