Skip to content

vModal 弹窗

模态框组件。

基础用法

vue
<script setup>
import { ref } from 'vue'
import { vModal } from '@twi1i9ht/visual-lib'

const visible = ref(false)
</script>

<template>
  <button @click="visible = true">打开弹窗</button>

  <vModal v-model:visible="visible" title="弹窗标题">
    <p>弹窗内容</p>
  </vModal>
</template>

Props

属性类型默认值说明
visiblebooleanfalse是否显示
titlestring标题
widthstring | number'50%'宽度
closablebooleantrue是否显示关闭按钮
maskClosablebooleantrue点击遮罩关闭
centeredbooleanfalse垂直居中
destroyOnClosebooleanfalse关闭时销毁内容

Events

事件名参数说明
update:visiblevisible: boolean显示状态变化
close关闭时触发

Slots

插槽名说明
default弹窗内容
header自定义头部
footer自定义底部

Released under the MIT License.