0๐
โ
If you want the exact match, use an ==
or ===
for string compare. No need to use indexOf
.
methods: {
filterPerfectMatch(value, search) {
return value != null && value === search
},
},
You can also add toLowercase()
to value and search, but youโll need to add checks whether they are strings back.
0๐
found it was easy af:
filterPerfectMatch(value, search) {
if (value == search) {
console.log("value :" + value + ", search :" + search)
return value != null &&
search != null &&
typeof value === 'string' &&
value.toString().indexOf(search) !== -1
}
},
Source:stackexchange.com