This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<Promised :promise="usersPromise"> | |
<template v-slot:pending> | |
<p>Loading...</p> | |
</template> | |
<template v-slot="data"> | |
<ul> | |
<li v-for="user in data">{{ user.name }}</li> | |
</ul> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div v-if="error"> {{ error.message }}</div> | |
<Suspense v-else> | |
<template #default> | |
<Admins /> | |
<Users /> | |
</template> | |
<template #fallback> | |
<div>Loading...</div> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div v-for="user in users"> {{ user.name }} </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default defineComponent({ | |
async setup() { | |
const users = await fetchUsers(); | |
return { users }; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<div v-if="isLoading"> Loading ... </div> | |
<div v-else="error"> {{ error.message }} <button @click="getUsers">try again</button> </div> | |
<div v-else> {{ data }} </div> | |
</div> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ref } from 'vue'; | |
export default defineComponent({ | |
setup() { | |
const isLoading = ref(false); | |
const error = ref(null); | |
const data = ref(null); | |
const getUsers = async () => { | |
isLoading.value = true; | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function reviveTaskInstance(instance: TaskInstance<any>) { | |
if (instance.isError) { | |
instance._deferredObject.promise = Promise.reject(instance.error); | |
} else { | |
// TODO: fix this | |
instance._deferredObject.promise = Promise.resolve(instance.value) as unknown as Promise<void>; | |
} | |
instance.cancel = () => {}; | |
instance.canceledOn = (signal) => instance; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "AD", | |
"name": "Andorra", | |
"type": "land", | |
"items": [] | |
}, | |
{ | |
"id": "AE", | |
"name": "United Arab Emirates", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "AD", | |
"name": "Andorra", | |
"type": "land", | |
"items": [ | |
{ | |
"fieldId": 0, | |
"value": 0 | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "SM", | |
"name": "San Marino", | |
"type": "land", | |
"items": [ | |
{ | |
"fieldId": 0, | |
"value": 1263 | |
} |