diff --git a/src/composables/useCommon.js b/src/composables/useCommon.js index a028849d0405d0ddb4ea7017abdc5d1d291bca4c..93c3433186789d8ad03e5e136c35cad6f2627754 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 657458712421111d059791a28e5e450cc4fbb1f5..a4542fd869395130b21a2ece8fd28e935d90cd61 100644 --- a/src/pages/coupon/list.vue +++ b/src/pages/coupon/list.vue @@ -1,26 +1,24 @@