This repository was archived by the owner on Aug 31, 2024. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork0
This Vue 3 plugin allows you to create computed properties that are computed asynchronously.
NotificationsYou must be signed in to change notification settings
mainclass/vue3-async-computed
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This Vue 3 plugin allows you to create computed properties that are computed asynchronously.
import*asVuefrom'vue';import*asAsyncComputedfrom'vue3-async-computed';constasyncComputed=AsyncComputed.createPlugin({ref:Vue.ref});Vue.createApp({data(){return{userID:1,}},}).use(asyncComputed,{asyncprofile(result){result.value=`loading profile for user${this.userID}...`;constresponse=awaitfetch(`https://httpbin.org/get?userID=${this.userID}`);constdata=awaitresponse.json();result.value=data;},}).mount('#app');
And then, in HTML:
<div>{{ userID }}: {{ profile }}</div>
Install usingnpm install vue3-async-computed
- Basic example, the app displays price information for any selected crypto currency:JSFiddle
Describe how to approach manual re-calculation of the async computed properties. Provide an example.
About
This Vue 3 plugin allows you to create computed properties that are computed asynchronously.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published