0👍
Your problem here (likely) is due to the fact that you are calling the fetchWords()
function before the component renders, but not telling it to re-render after the data is retrieved. By that point in time, Vue has no idea that you were triggering a "redraw". You have two options:
- You can use the
mounted()
(Vue Lifecycle Hooks) lifecycle hook and then your data will be requested as soon as Vue.js mounts the component and then it will know to reset that data point. - You can call the
this.nextTick()
function (nextTick() reading) to force Vue.js to "redraw" the UI.
This is all still a guess, but that’s what I have seen thus far when dealing with HTTP and the Vue.js lifecycle hooks.
Source:stackexchange.com