<template>
  <h1>一个异步组件</h1>
</template>

<script lang="ts">
import {defineComponent} from 'vue'

function sleep(timeout: number | undefined){
  return new Promise(resolve => setTimeout(resolve,timeout))
}

export default defineComponent({
  name: "AsyncComponent",
  props:{
    timeout:{
      type:Number,
      required:true
    }
  },
  async setup(props){
    await sleep(props.timeout)
  }
})
</script>

<style scoped>

</style>