As a newcomer to Vue.js, I am in the process of learning how to display data retrieved from a server. In my new Vue app, I have defined a method:
methods: {
getData: function() {
// making a request, parsing the response and pushing it to the array.
console.log(arr);
return arr;
}
}
The method is functioning properly as I can successfully log the array to the console upon clicking a button.
<button v-on:click="getData">Get me some data</button>
However, integrating this array into the app has proven to be a challenge. My initial approach was to utilize computed properties like so:
computed: {
values: function() {
return this.getData;
}
}
... and then attempt to display it using a for
loop:
<p v-for="value in values">{{ value }}></p>
Unfortunately, this solution did not yield the desired outcome. It seems that I may have misunderstood some aspects of Vue's functionality in this context.