[Vuejs]-Call api on click with Nuxt

3👍

For example using the nuxt axios module:

<button @click="myMethod"> click me </button>
methods:{
  myMethod() { 
    this.$axios.get('some-api-url').then(response => {
      console.log(response)
    })
  }
}

Leave a comment