Skip to content

Instantly share code, notes, and snippets.

@MartinMalinda
Created July 4, 2020 11:38
Show Gist options
  • Save MartinMalinda/547a25ded41e83ef7fa524dc0323dc97 to your computer and use it in GitHub Desktop.
Save MartinMalinda/547a25ded41e83ef7fa524dc0323dc97 to your computer and use it in GitHub Desktop.
<template>
<div v-if="error"> {{ error.message }}</div>
<Suspense v-else>
<template #default>
<Admins />
<Users />
</template>
<template #fallback>
<div>Loading...</div>
</template>
</Suspense>
</template>
export default defineComponent({
setup() {
const error = ref(null);
onErrorCaptured(caughtError => {
error.value = caughtError;
return true;
})}
return { error };
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment