代码拉取完成,页面将自动刷新
<template>
<Modal v-bind="getBindValue" v-on="$listeners" @cancel="onCancel">
<slot></slot>
<template #[item]="data" v-for="item in Object.keys(omit($slots, 'default'))">
<slot :name="item" v-bind="data || {}"></slot>
</template>
</Modal>
</template>
<script lang="ts">
/**
* 该组件用于处理Modal.tsx 属性绑定无效的bug 而新建的组件
*/
import { Modal } from 'ant-design-vue'
import { computed, defineComponent, ref, toRefs, unref } from 'vue'
import { basicProps } from '../props'
import { useModalDragMove } from '../hooks/useModalDrag'
import { useAttrs } from '/@/hooks/core/useAttrs'
import { ModalProps } from '../typing'
import { omit } from 'lodash-es'
export default defineComponent({
name: 'VModal',
inheritAttrs: false,
props: basicProps,
emits: ['cancel'],
components: { Modal },
setup(props, { emit }) {
const propsRef = ref<Partial<ModalProps> | null>(null)
const { visible, draggable, destroyOnClose } = toRefs(props)
const attrs = useAttrs()
useModalDragMove({
visible,
destroyOnClose,
draggable,
})
const onCancel = (e: Event) => {
emit('cancel', e)
}
// Custom title component: get title
const getMergeProps = computed((): Recordable => {
return {
...omit(props, 'draggable'),
...(unref(propsRef) as any),
}
})
const getBindValue = computed((): Recordable => {
const attr = {
...attrs,
...unref(getMergeProps),
}
return attr
})
return { getBindValue, onCancel, omit }
},
})
</script>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。