When the user will give input to the search box I want it to check if this string is available or not and display it. Currently, it is only showing results matched with uppercase to uppercase and lowercase to lowercase. But I want to match with the string uppercase and lowercase both at a time.
Example: Let’s say we are searching for TopLeader. when a user writes top it doesn’t show the result but when the user type Top the TopLeader result shows. I want when the user will search top or TOP still result will show.
Here is my code
Template:
<tbody>
<tr v-for="item in filteredData" :key="item.id">
<FLM :flm="item.flm" :flmCode="item.flm_code" />
</tr>
</tbody>
Script:
data() {
return {
worksheet: [],
search: "",
};
},
computed: {
filteredData: function () {
return this.worksheet.filter((result) => {
console.log(result);
return result.NSM.match(this.search);
});
},
},
mounted() {
fetch("http://localhost:3000/worksheet")
.then((response) => response.json())
.then((data) => (this.worksheet = data))
.catch((err) => console.log(err.msg));
},