vue-async-computed icon indicating copy to clipboard operation
vue-async-computed copied to clipboard

Use with Nuxt?

Open vzakharov opened this issue 3 years ago • 1 comments

Sorry for a noob question, but how do I use it with Nuxt?

vzakharov avatar Sep 25 '21 09:09 vzakharov

@vzakharov just install the package and register it as a plugin

myPlugin.client.js

import Vue from 'vue'
import AsyncComputed from 'vue-async-computed'

Vue.use(AsyncComputed)

then in your component, use

myComponent.vue

export default {
   asyncComputed: {
       async myResolvedValue() {
          return await api.get(`/users/${this.value.username}/message/`, {'headers': { 'Authorization': 'JWT ...' }})
              .then(response => response.data)
       }
    }
}

athulanilthomas avatar Feb 22 '22 05:02 athulanilthomas