- 定义一个 Modal 组件
{
{ title }}
<button @click=“buttonClick”>Close
- 使用 Modal 组件
<button @click=“openModal”>modal
<Modal :title=“modalTitle” :isOpen=“modalIsOpen” @close-modal=“onModalClose”>
My modal
1.3 预览效果
![请添加图片描述](https://img-blog.csdnimg.cn/f50e15553930422e94d6413a4a798465.gif)
二、Suspense
Suspense 官方文档
Waring:作为 Vue3 中实验性的功能,随时都有可能修改,所以不建议用于生成环境的应用