1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
| import { Modal } from 'ant-design-vue';
| import { defineComponent, toRefs, unref } from 'vue';
| import { basicProps } from '../props';
| import { useModalDragMove } from '../hooks/useModalDrag';
| import { useAttrs } from '@vben/hooks';
| import { extendSlots } from '/@/utils/helper/tsxHelper';
|
| export default defineComponent({
| name: 'Modal',
| inheritAttrs: false,
| props: basicProps as any,
| emits: ['cancel'],
| setup(props, { slots, emit }) {
| const { visible, draggable, destroyOnClose } = toRefs(props);
| const attrs = useAttrs();
| useModalDragMove({
| visible,
| destroyOnClose,
| draggable,
| });
|
| const onCancel = (e: Event) => {
| emit('cancel', e);
| };
|
| return () => {
| const propsData = { ...unref(attrs), ...props, onCancel } as Recordable;
| return <Modal {...propsData}>{extendSlots(slots)}</Modal>;
| };
| },
| });
|
|