I am creating a searching input using Vue and and I made a method to check if each item should be visible or not and compare the current user input with the data of the item, and return true or false. The problem I have with the console, it shows me an Error related to "toLowerCase". please some help and advice. Thanks in advance.
<div
v-for="item in itemList"
:key="item.name"
class="dropdown-item"
v-show="itemVisible(item)"
/>
export default {
name: "Demo",
data() {
return {
inputValue: "",
itemList: [],
selectedItem: {},
};
},
itemVisible(item) {
let currentName = item.name.toLowerCase();
let currentInput = this.inputValue.toLowerCase();
return currentName.includes(currentInput);
}
}