对比新文件 |
| | |
| | | import { createApp, h, ref, nextTick } from 'vue' |
| | | import BaseDialog from '@/components/BaseDialog/index.vue' |
| | | import styles from './ConfirmBox.module.scss' |
| | | export const ConfirmBox = (text: string, title = '纭') => { |
| | | return new Promise((resolve, reject) => { |
| | | const mountNode = document.createElement('div') |
| | | document.body.appendChild(mountNode) |
| | | |
| | | const visible = ref(true) |
| | | const app = createApp({ |
| | | render() { |
| | | return h( |
| | | BaseDialog, |
| | | { |
| | | modelValue: visible.value, |
| | | 'onUpdate:modelValue': (value: boolean) => { |
| | | visible.value = value |
| | | }, |
| | | title: title, |
| | | width: '379px', |
| | | onConfirm: () => { |
| | | resolve(true) |
| | | nextTick(() => { |
| | | mountNode.remove() |
| | | }) |
| | | }, |
| | | onClose: () => { |
| | | reject(false) |
| | | nextTick(() => { |
| | | mountNode.remove() |
| | | }) |
| | | }, |
| | | }, |
| | | h('div', { class: styles.deleteDialog }, text) |
| | | ) |
| | | }, |
| | | }) |
| | | |
| | | app.mount(mountNode) |
| | | }) |
| | | } |