I'm encountering issues fetching data from an external JSON file for a specific variable. I suspect that the problem lies in using Vue.js within the HTML, as it seems to be having trouble interpreting my code correctly.:joy:
jsfiddle
Additionally, I'm struggling to access values from the JSON file.
new Vue({
el: '#app',
data() {
return {
searchResult: [],
search: '',
}
},
created: function() {
this.searchResult = [
{
"id": 0,
"title": "d",
"img": "src"
}
];
},
computed: {
filteredName: function() {
return this.searchResult.filter((x) => {
return x.title.match(this.search)
});
},
allOK: function () {
if (this.search.valueOf() === "") {
return false
} else {
return true
}
},
hrefResult: function () {
return "/item?=" + this.searchResult.id
}
}
});
Does anyone have any suggestions on how to resolve this dilemma? :(