0👍
methods: {
onChange() {
axios
.get("myURL")
.then((response) => {
this.filteredresults=FilterOnInput((response.data,document.getelementById("IdOfTheInput").value)
})
.catch((error) => {
console.log(error);
this.errors = true;
})
.finally(() => console.log("Data successfully loaded"));
this.modal = true;
},
//new !!
FilterOnInput(list, inputFilter) {
let filteredList = [];
for (let i = 0; i < list.length; i++) {
let name = list[i].Name; //if given returns are objects
if (name.toUpperCase().includes(inputFilter.toUpperCase())) {
filteredList.push(list[i]);
}
}
if (inputFilter.length === 0) {
filteredList = list;
}
return filteredList;
}
This getelementById("IdOfTheInput").value is only needed when working with id if you use a v-model, just put the name of the variable you use.
- [Vuejs]-Is there a way to add white space before and after x-axis in an apex chart?
- [Vuejs]-NodeJS request with range does not work with HTML5 video
Source:stackexchange.com