riku
2023-12-22 e5875000e60d4976f159f287ae3773f1d11960b3
src/composables/formConfirm.js
@@ -1,4 +1,4 @@
import { defineProps, onActivated, onDeactivated, ref, watch } from 'vue';
import { defineProps, onActivated, onDeactivated, reactive, ref, watch } from 'vue';
import { useCloned } from '@vueuse/core';
import { useMessageBoxTip, useMessageBox } from './messageBox';
@@ -26,7 +26,8 @@
  // });
  //表单内容
  const formObj = ref(defaultForm ? defaultForm : {});
  const formObj = reactive(defaultForm ? defaultForm : {});
  // const formObj = reactive({});
  let formObjClone = useCloned(formObj, { manual: true });
  //表单组件引用
  const formRef = ref(null);
@@ -92,9 +93,10 @@
  };
  // 提交表单
  const onSubmit = function () {
    formRef.value.validate((valid) => {
  const onSubmit = function (messageBox = true) {
    formRef.value.validate(async (valid) => {
      if (valid) {
        if (messageBox) {
        useMessageBoxTip({
          confirmMsg: submit.msg,
          confirmTitle: submit.title,
@@ -104,6 +106,10 @@
            return res;
          }
        });
        } else {
          await submit.do();
          submited();
        }
      }
    });
  };