Top-level await
Top-level await
can be used inside
<script setup>
. The resulting code will be
compiled as async setup()
:
<script setup>
const post = await fetch(`/api/post/1`).then((r) => r.json())
</script>
Top-level await
can be used inside
<script setup>
. The resulting code will be
compiled as async setup()
:
<script setup>
const post = await fetch(`/api/post/1`).then((r) => r.json())
</script>