I am facing an issue with my Vue.js 3 app. I am attempting to search through an array of objects within the app. You can find a fiddle showcasing the problem here. The problematic code snippet from the fiddle is as follows:
async runSearch() {
let searchResults = this.data;
if (this.searchQuery) {
let info = JSON.stringify(searchIndex);
alert(info);
console.log(searchIndex);
searchResults = await courseIndex.search(courses);
}
this.results = searchResults;
}
It seems like the variable searchIndex
is not recognized. However, I have properly defined it in the model here:
data() {
return {
searchIndex: null,
searchQuery: null,
data: data,
results: null,
}
}
I am puzzled by why I am unable to execute a successful search function. What could be causing this issue?