Skip to content

how to use await in tag <script setup> #266

@syifeng

Description

@syifeng
<script setup async>
import { ref, watch } from 'vue'
import HelloWorld from './components/HelloWorld.vue'
import { getMedInfos } from './api/medInfo'
const msg = ref('msg')
export const medInfos = await getMedInfos(1, 10)
</script>

when I use the await function in the tag '<script setup>' I got the error

<script setup> cannot contain ES module exports what should i do thanks for the answer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions