Skip to content

witDialog Dialog Component

witDialog is an enhanced dialog component based on Element Plus Dialog, providing extended features like fullscreen, loading state, theme styles, supports dragging and animation effects, providing users with a more flexible and beautiful dialog experience.

Usage Example

vue
<template>
  <div>
    <el-button type="primary" @click="showDialog = true">
      Open Dialog
    </el-button>
    
    <witDialog
      v-model="showDialog"
      title="Dialog Title"
      width="500px"
      :loading="loading"
      theme="primary"
    >
      <div>
        <p>Dialog content area</p>
        <p>Can place forms, tables, or any content</p>
      </div>
      <template #footer>
        <el-button @click="showDialog = false">Cancel</el-button>
        <el-button type="primary" @click="handleConfirm">Confirm</el-button>
      </template>
    </witDialog>
  </div>
</template>

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

const showDialog = ref(false)
const loading = ref(false)

const handleConfirm = () => {
  loading.value = true
  // Simulate async operation
  setTimeout(() => {
    loading.value = false
    showDialog.value = false
  }, 2000)
}
</script>

API

Property NameTypeDefault ValueDescription
modelValue[Boolean]falseControls dialog visibility, supports v-model two-way binding
title[String]''Dialog title
width[String]'50%'Dialog width
showClose[Boolean]trueWhether to show close button
showFullscreen[Boolean]trueWhether to show fullscreen button
loading[Boolean]falseWhether to show loading state
animated[Boolean]trueWhether to enable animation effects
theme[String]''Dialog theme, optional values: 'default', 'plain', 'primary'
draggable[Boolean]trueWhether to support dragging
overflow[Boolean]trueWhether to allow content overflow
alignCenter[Boolean]trueWhether to center vertically
closeOnClickModal[Boolean]falseWhether clicking mask closes dialog
closeOnPressEscape[Boolean]falseWhether pressing ESC key closes dialog
...ElDialog.props[Object]-Inherits all properties of Element Plus Dialog

Slots

Slot NameDescription
defaultDialog content area
headerCustom dialog header
footerCustom dialog footer button area

Events

Event NameDescriptionParameters
update:modelValueTriggered when dialog visibility changesNew visibility state (Boolean)
...ElDialog.eventsInherits all events of Element Plus Dialog-

TIP

  1. Double-clicking the dialog title can toggle fullscreen state, or click the fullscreen button in the top right corner.
  2. Supports setting different theme styles through the theme property.
  3. The component has dragging enabled by default, can be disabled via draggable property.
  4. Loading state is controlled via loading property, shows loading animation in dialog content area.
  5. Inherits all properties of Element Plus Dialog, such as: center, modal, lockScroll, etc., can be flexibly configured as needed.

湘ICP备2024070110号