From 6f7a785c804c02feefa5fa9a139227776bd43960 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 9 Mar 2023 22:24:55 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BC=98=E5=8C=96=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=9A=84=20loading=20=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/infra/config/form.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/views/infra/config/form.vue b/src/views/infra/config/form.vue index ab2a9551..6a80ae74 100644 --- a/src/views/infra/config/form.vue +++ b/src/views/infra/config/form.vue @@ -32,7 +32,7 @@ @@ -48,9 +48,8 @@ const message = useMessage() // 消息弹窗 const modelVisible = ref(false) // 弹窗的是否展示 const modelTitle = ref('') // 弹窗的标题 -const formLoading = ref(false) // 表单的数据 Loading 加载 +const formLoading = ref(false) // 表单的 Loading 加载:1)修改时的数据加载;2)提交的按钮禁用 const formType = ref('') // 表单的类型:create - 新增;update - 修改 -const submitLoading = ref(false) // 操作按钮的 Loading 加载:避免重复提交 // let formRef = ref() // 表单的 Ref const formData = reactive({ id: undefined, @@ -95,13 +94,18 @@ defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗 /** 提交表单 */ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 const submitForm = async () => { + if (true) { + formLoading.value = true + console.log('1111') + return + } const formRef = proxy.$refs['formRef'] // 校验表单 if (!formRef) return const valid = await formRef.validate() if (!valid) return // 提交请求 - submitLoading.value = true + formLoading.value = true try { const data = formData as ConfigApi.ConfigVO if (formType.value === 'create') { @@ -114,7 +118,7 @@ const submitForm = async () => { modelVisible.value = false emit('success') } finally { - submitLoading.value = false + formLoading.value = false } }