【更新】调整XnFormContainer

pull/103/head^2
xlzy 2023-03-25 17:41:16 +08:00 committed by 小诺
parent 23d0791e4e
commit 7384ed0ce3
1 changed files with 5 additions and 14 deletions

View File

@ -1,20 +1,17 @@
<template> <template>
<Modal v-if="isModal" :visible="visible" @cancel="cancel" v-bind="$attrs"> <a-modal v-if="isModal" :visible="visible" @cancel="cancel" v-bind="$attrs">
<template v-for="slotKey in slotKeys" #[slotKey]> <template v-for="slotKey in slotKeys" #[slotKey]>
<slot :name="slotKey" /> <slot :name="slotKey" />
</template> </template>
</Modal> </a-modal>
<Drawer v-else :visible="visible" v-bind="$attrs" :footer-style="{ textAlign: 'right' }"> <a-drawer v-else :visible="visible" v-bind="$attrs" :footer-style="{ textAlign: 'right' }">
<template v-for="slotKey in slotKeys" #[slotKey]> <template v-for="slotKey in slotKeys" #[slotKey]>
<slot :name="slotKey" /> <slot :name="slotKey" />
</template> </template>
</Drawer> </a-drawer>
</template> </template>
<script> <script>
import { Drawer, Modal } from 'ant-design-vue'
import { modalProps } from 'ant-design-vue/es/modal/Modal'
import { drawerProps } from 'ant-design-vue/es/drawer'
import { mapState } from 'pinia' import { mapState } from 'pinia'
import { globalStore } from '@/store' import { globalStore } from '@/store'
@ -24,19 +21,13 @@
} }
export default { export default {
name: 'XnFormContainer', name: 'XnFormContainer',
components: {
Drawer,
Modal
},
inheritAttrs: false, inheritAttrs: false,
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false, default: false,
required: true required: true
}, }
...modalProps,
...drawerProps
}, },
computed: { computed: {
...mapState(globalStore, ['formStyle']), ...mapState(globalStore, ['formStyle']),