[Vuejs]-Calling a function in Vue.js 3 at <template>

3👍

You can only use/call a variable/function in the template if you explicitly return it from the setup() function.

So you’d need to change your code to:

return {
  data,
  image,
  fun,
  fetchAPI
}

for it to work as you intend.

Leave a comment