mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-24 14:45:15 +00:00
19 lines
377 B
Vue
19 lines
377 B
Vue
<template>
|
|
<div>
|
|
{{ state.attr }}
|
|
{{ data.something }}
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
const { data, error } = await useAsyncData(() => {
|
|
throw new Error('some error')
|
|
}, { server: true })
|
|
|
|
if (error.value) {
|
|
throw createError({ statusCode: 422, fatal: true, statusMessage: 'This is a custom error' })
|
|
}
|
|
|
|
const state = ref({ attr: 'Hello World' })
|
|
</script>
|