vue3-async-computed

This Vue 3 plugin allows you to create computed properties that are computed asynchronously
6,487 11
Install
npm install vue3-async-computed
Latest Version:3.0.0
Vue:3
License:ISC
Last Updated:May 1, 2021
Links: GitHub  ·  npm
Maintainer: andriika

vue3-async-computed

This Vue 3 plugin allows you to create computed properties that are computed asynchronously.

import * as Vue from 'vue';
import * as AsyncComputed from 'vue3-async-computed';

const asyncComputed = AsyncComputed.createPlugin({ ref: Vue.ref });

Vue.createApp({

    data() {
        return {
            userID: 1,
        }
    },

}).use(asyncComputed, {

    async profile(result) {
        result.value = `loading profile for user ${this.userID}...`;
        const response = await fetch(`https://httpbin.org/get?userID=${this.userID}`);
        const data = await response.json();
        result.value = data;
    },

}).mount('#app');

And then, in HTML:

<div>{{ userID }}: {{ profile }}</div>

Install

Install using npm install vue3-async-computed

Examples

  • Basic example, the app displays price information for any selected crypto currency: JSFiddle

Todo

Describe how to approach manual re-calculation of the async computed properties. Provide an example.

Related Packages

vue-async-computed

Async computed properties for Vue

954,094 1,100
vue-async-computed-decorator

A vue-class-component decorator for vue-async-computed

40,233 15
@braw/async-computed

Compute values asynchronously with the Vue Composition API

11,766 1
vue-asyncable

Async data loading plugin for Vue.js

10,917 2
vue-computed-helpers

Computed helpers for Vue apps

3,730 284

Version History

Version Released Vue License
3.0.0 >=3.0.0 ISC
2.0.2 ISC
2.0.1 ISC
1.0.1 ISC
1.0.0 ISC