修复 XModel 高度无法自适应的问题
parent
d985ef194e
commit
53a9f3dabf
|
@ -9,7 +9,7 @@ const props = defineProps({
|
|||
loading: propTypes.bool.def(false),
|
||||
title: propTypes.string.def('弹窗'),
|
||||
width: propTypes.string.def('40%'),
|
||||
height: propTypes.string.def('60%'),
|
||||
height: propTypes.string,
|
||||
minWidth: propTypes.string.def('460'),
|
||||
minHeight: propTypes.string.def('320'),
|
||||
showFooter: propTypes.bool.def(true)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<!-- 弹窗 -->
|
||||
<XModal :title="modelTitle" :loading="modelLoading" v-model="modelVisible" height="270px">
|
||||
<XModal :title="modelTitle" :loading="modelLoading" v-model="modelVisible">
|
||||
<!-- 表单:添加/修改 -->
|
||||
<Form
|
||||
ref="formRef"
|
||||
|
@ -45,14 +45,14 @@ const formRef = ref<FormExpose>() // 表单 Ref
|
|||
const detailData = ref() // 详情 Ref
|
||||
|
||||
// 打开弹窗
|
||||
const openModal = async (type: string, rowId?: number) => {
|
||||
const openModal = async (type: string, id?: number) => {
|
||||
modelVisible.value = true
|
||||
modelLoading.value = true
|
||||
modelTitle.value = t('action.' + type)
|
||||
actionType.value = type
|
||||
// 设置数据
|
||||
if (rowId) {
|
||||
const res = await PostApi.getPostApi(rowId)
|
||||
if (id) {
|
||||
const res = await PostApi.getPostApi(id)
|
||||
if (type === 'update') {
|
||||
unref(formRef)?.setValues(res)
|
||||
} else if (type === 'detail') {
|
||||
|
|
|
@ -66,7 +66,7 @@ const [registerTable, { reload, deleteData, exportList }] = useXTable({
|
|||
|
||||
// 表单相关的变量
|
||||
const modalRef = ref()
|
||||
const openModal = (actionType: string, id?: number) => {
|
||||
modalRef.value.openModal(actionType, id)
|
||||
const openModal = (type: string, id?: number) => {
|
||||
modalRef.value.openModal(type, id)
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue