0👍
You are getting the error
items is not defined
because of following line:
created: function () {
console.log("Loading data...")
this.loadData();
console.log(items) <== this should be console.log(this.items)
- [Vuejs]-What is the best way to propagate event to few component instance in Vue Js?
- [Vuejs]-Promises, argument in .then() is undefined, how to pass?
0👍
Turns out there was a few issues in my code.
1) As was pointed out by Saurabh, I forgot to put this.items
instead of items
.
2) this
can’t be referenced inside of the function I defined as I have it… instead, the function has to be defined with =>
, for example:
$.get('http://localhost:4567/getQueue').then((response) => {
this.items = response.data.results;
console.log("loadData finished - items length is: "+this.items.length)
})
3) The big error I had was that my div bind with items was inside the table tag, which apparently isn’t okay to do. Instead I applied the Vue binds to the existing tags (table, tr).
- [Vuejs]-Vue.js not working on Heroku Rails app
- [Vuejs]-How to sum item's quantity separately in v-for(VueJS)
Source:stackexchange.com