Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2023-04-28 13:18:13 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4b8b83bc1b6a22b62b46a84e6aa16c126bec4e60
4b8b83bc
1 parent
8058e264
fix 重复提交表单问题处理
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
src/views/index.vue
src/views/index.vue
View file @
4b8b83b
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-0
3-29 17:57:51
* @LastEditTime: 2023-0
4-28 13:13:13
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
...
...
@@ -28,7 +28,7 @@
:is="item.component" :item="item" @active="onActive" />
</van-cell-group>
<div v-if="formData.length && PCommit.visible" style="margin: 16px">
<van-button round block type="primary" native-type="submit">
<van-button round block type="primary" native-type="submit"
:disabled="submitStatus"
>
{{ PCommit.text ? PCommit.text : '提交' }}
</van-button>
</div>
...
...
@@ -502,6 +502,8 @@ const preValidData = (values) => {
return _.assign(postData.value, rest_data);
}
const submitStatus = ref(false);
const onSubmit = async (values) => {
// 表单数据处理
postData.value = preValidData(values);
...
...
@@ -514,12 +516,17 @@ const onSubmit = async (values) => {
console.warn(postData.value);
}
if (model === 'edit' || model === 'preview') return false;
// 提交按钮禁用
submitStatus.value = true;
// 通过验证
const result = await addFormDataAPI({
form_code: $route.query.code,
data: postData.value,
});
if (result.code) {
// 提交按钮禁用状态
submitStatus.value = false;
//
showSuccessToast("提交成功");
// 缓存表单返回值
store.changeSuccessInfo(result.data);
...
...
@@ -532,8 +539,13 @@ const onSubmit = async (values) => {
path: "/success",
});
}
} else {
// 提交按钮禁用状态
submitStatus.value = false;
}
} else {
// 提交按钮禁用状态
submitStatus.value = false;
console.warn(validOther().key + "不通过验证");
// // 图片上传控件报错提示
// if (validOther().key === "image_uploader") {
...
...
Please
register
or
login
to post a comment