Top-level await doesn't work
zhenhappy opened this issue · 2 comments
zhenhappy commented
The page is blank after using top-level await.
<script setup>
const a = await fetch(`https://httpbin.org/get`).then(r => r.json())
const b = 'hello'
</script>
<template>
<div>
{{ a }}
{{ b }}
</div>
</template>
leopiccionia commented
As I understand it, components with async setup
should be wrapped inside Suspense
component.
https://v3.vuejs.org/api/sfc-script-setup.html#top-level-await
https://v3.vuejs.org/guide/migration/suspense.html#introduction
iamandrewluca commented