Skip to content

Modal

A modal dialog that displays content in a layer above the page. Supports confirmation/cancel actions and imperative invocation.

Basic Usage

vue
<script setup>
import { ref } from 'vue'
const show = ref(false)
</script>

<template>
  <see-modal
    v-model:show="show"
    title="Confirm"
    content="Are you sure you want to proceed?"
    @confirm="onConfirm"
    @cancel="onCancel"
  />
</template>

Imperative Usage

ts
import { useModal } from 'see-u-ui'

const modal = useModal()

// Confirmation dialog
modal.confirm({
  title: 'Confirm',
  content: 'Are you sure?',
  onConfirm: () => console.log('confirmed'),
})

// Alert dialog
modal.alert({
  title: 'Notice',
  content: 'Operation successful.',
})

Props

PropTypeDefaultDescription
showbooleanfalseWhether to show the modal
titlestring''Modal title
contentstring''Modal body content
isShowHeaderbooleantrueWhether to show header
isShowFooterbooleantrueWhether to show footer buttons
confirmTextstring'Confirm'Confirm button text
cancelTextstring'Cancel'Cancel button text
isShowCancelBtnbooleantrueWhether to show cancel button
confirmTypestring'primary'Confirm button style: primary, danger, warning
isConfirmLoadingbooleanfalseWhether confirm button shows loading state
widthstring''Custom modal width
beforeClosefunctionundefinedCallback before closing, return false to prevent close

Events

EventParametersDescription
onConfirm-Triggered when confirm button is clicked
onCancel-Triggered when cancel button is clicked
onOpen-Triggered when modal opens
onClose-Triggered when modal closes
update:show(value: boolean)Triggered when show state changes

Liao ICP No. 2025070134