【发布时间】:2022-01-09 20:17:53
【问题描述】:
当我搜索字母时,我下面的代码运行良好,但是当我搜索像 flat_number 这样的数字时,它只会给我错误 flat.flat_number.toLowerCase is not a function
filteredList() {
return this.Flats.filter((flat) => {
return (
//i tried commented code but it didn;t work
// this.Flats.filter(flat_number => String(flat_number).includes(this.search)) ||
flat.buyer
.toLowerCase()
.includes(this.search.toLowerCase()) ||
flat.flat_number //flat_number not working
.toLowerCase()
.includes(this.search.toLowerCase()) ||
flat.city
.toLowerCase()
.includes(this.search.toLowerCase())
);
});
},
有什么帮助吗?
【问题讨论】:
-
请分享
this.Flats -
这是一个API数据@evolutionxbox
-
@LucaKiebel 我需要它作为搜索栏
-
好吧,数字没有
toLowerCase()方法 -
@LucaKiebel 我试过了,但没用
this.Flats.filter(flat_number => String(flat_number).includes(this.search))
标签: javascript vue.js