From c590551a27cc69a9e7df5b6d2148ff88ca243ddb Mon Sep 17 00:00:00 2001 From: kadycui Date: Wed, 20 Sep 2023 09:39:12 +0800 Subject: [PATCH] =?UTF-8?q?ADD:=20=E4=BC=98=E6=83=A0=E5=88=B8=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/composables/useCommon.js | 9 ++- src/pages/coupon/list.vue | 132 ++++++++++++++++++++++++----------- 2 files changed, 100 insertions(+), 41 deletions(-) diff --git a/src/composables/useCommon.js b/src/composables/useCommon.js index a028849..93c3433 100644 --- a/src/composables/useCommon.js +++ b/src/composables/useCommon.js @@ -139,7 +139,14 @@ export function useInitForm(opt = {}) { if (!valid) return formDrawerRef.value.showLoading() - const fun = editId.value ? opt.update(editId.value, form) : opt.create(form) + let body = {} + if (opt.beforeSubmit && typeof opt.beforeSubmit == "function"){ + body = opt.beforeSubmit({ ...form }) + } else { + body = form + } + + const fun = editId.value ? opt.update(editId.value, body) : opt.create(body) fun.then((res) => { console.log(res); toast(drawerTitle.value + "成功") diff --git a/src/pages/coupon/list.vue b/src/pages/coupon/list.vue index 6574587..a4542fd 100644 --- a/src/pages/coupon/list.vue +++ b/src/pages/coupon/list.vue @@ -1,26 +1,24 @@