提交模型设计代码

This commit is contained in:
zhujiyan
2024-05-08 20:44:33 +08:00
parent 1e645adce8
commit 6076cec029
71 changed files with 8222 additions and 1866 deletions

View File

@@ -0,0 +1,54 @@
<template>
<el-dialog v-if="isModal" v-model="visibles" @cancel="cancel" v-bind="$attrs">
<template v-for="slotKey in slotKeys" #[slotKey]>
<slot :name="slotKey" />
</template>
</el-dialog>
<el-drawer v-else v-model="visibles" v-bind="$attrs" :footer-style="{ textAlign: 'right' }">
<template v-for="slotKey in slotKeys" #[slotKey]>
<slot :name="slotKey" />
</template>
</el-drawer>
</template>
<script>
import { mapState } from 'pinia'
import { globalStore } from '@/store'
const FormContainerTypeEnum = {
DRAWER: 'drawer',
MODAL: 'modal'
}
export default {
inheritAttrs: false,
props: {
visible: {
type: Boolean,
default: false,
required: true
}
},
computed: {
...mapState(globalStore, ['formStyle']),
slotKeys() {
return Object.keys(this.$slots)
},
isModal() {
return FormContainerTypeEnum.MODAL === this.formStyle
}
},
data() {
return {
visibles: ''
}
},
methods: {
cancel() {
this.$emit('close')
}
},
mounted() {
this.visibles = this.visible
}
}
</script>