修复 XModel 高度无法自适应的问题

This commit is contained in:
YunaiV 2023-02-11 16:32:10 +08:00
parent d985ef194e
commit 53a9f3dabf
3 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,7 @@ const props = defineProps({
loading: propTypes.bool.def(false), loading: propTypes.bool.def(false),
title: propTypes.string.def('弹窗'), title: propTypes.string.def('弹窗'),
width: propTypes.string.def('40%'), width: propTypes.string.def('40%'),
height: propTypes.string.def('60%'), height: propTypes.string,
minWidth: propTypes.string.def('460'), minWidth: propTypes.string.def('460'),
minHeight: propTypes.string.def('320'), minHeight: propTypes.string.def('320'),
showFooter: propTypes.bool.def(true) showFooter: propTypes.bool.def(true)

View File

@ -1,6 +1,6 @@
<template> <template>
<!-- 弹窗 --> <!-- 弹窗 -->
<XModal :title="modelTitle" :loading="modelLoading" v-model="modelVisible" height="270px"> <XModal :title="modelTitle" :loading="modelLoading" v-model="modelVisible">
<!-- 表单添加/修改 --> <!-- 表单添加/修改 -->
<Form <Form
ref="formRef" ref="formRef"
@ -45,14 +45,14 @@ const formRef = ref<FormExpose>() // 表单 Ref
const detailData = ref() // Ref const detailData = ref() // Ref
// //
const openModal = async (type: string, rowId?: number) => { const openModal = async (type: string, id?: number) => {
modelVisible.value = true modelVisible.value = true
modelLoading.value = true modelLoading.value = true
modelTitle.value = t('action.' + type) modelTitle.value = t('action.' + type)
actionType.value = type actionType.value = type
// //
if (rowId) { if (id) {
const res = await PostApi.getPostApi(rowId) const res = await PostApi.getPostApi(id)
if (type === 'update') { if (type === 'update') {
unref(formRef)?.setValues(res) unref(formRef)?.setValues(res)
} else if (type === 'detail') { } else if (type === 'detail') {

View File

@ -66,7 +66,7 @@ const [registerTable, { reload, deleteData, exportList }] = useXTable({
// //
const modalRef = ref() const modalRef = ref()
const openModal = (actionType: string, id?: number) => { const openModal = (type: string, id?: number) => {
modalRef.value.openModal(actionType, id) modalRef.value.openModal(type, id)
} }
</script> </script>