我已经在Vue JS中创建了一个自定义搜索过滤器。它具有多个可过滤字段,并且我试图将用户键入的内容转换为小写形式的输入框,以保持一致。这是我的过滤器:
filteredProperties: function(){
return this.properties.filter((property) => {
return property.address.toLowerCase().match(this.searchAddress) && property.type.match(this.searchType) && property.bedrooms.match(this.searchBedrooms) && property.county.match(this.searchCounty)
});
}
我需要将.match(this.searchAddress)
转换为小写,使其与主地址部分匹配。
我尝试过:
.match(this.searchAddress).toLowerCase()
和
.match(this.searchAddress.toLowerCase())