浏览代码

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

YunaiV 2 年之前
父节点
当前提交
53a9f3dabf
共有 3 个文件被更改,包括 7 次插入7 次删除
  1. 1 1
      src/components/XModal/src/XModal.vue
  2. 4 4
      src/views/system/post/form.vue
  3. 2 2
      src/views/system/post/index.vue

+ 1 - 1
src/components/XModal/src/XModal.vue

@@ -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)

+ 4 - 4
src/views/system/post/form.vue

@@ -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') {

+ 2 - 2
src/views/system/post/index.vue

@@ -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>