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-01-17 18:06:33 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a99aa46654c729cac4915d85c121378582e733d9
a99aa466
1 parent
f2acbd44
过滤字段名为undefined的值,调试模式下打印提交数据
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
src/views/index.vue
src/views/index.vue
View file @
a99aa46
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-01-17 1
6:41:38
* @LastEditTime: 2023-01-17 1
7:22:59
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
...
...
@@ -359,13 +359,16 @@ const validOther = () => {
};
const onSubmit = async (values) => {
// 过滤掉标识为
ignore
的字段数据
let { ignore, ...rest_data } = values;
// 过滤掉标识为
ignore,undefined
的字段数据
let { ignore,
undefined,
...rest_data } = values;
// 合并自定义字段到提交表单字段
postData.value = _.assign(postData.value, rest_data);
// 检查非表单输入项
if (validOther().status) {
// 编辑模式不能提交数据
if (model === 'edit') {
console.warn(postData.value);
}
if (model === 'edit') return false;
// 通过验证
const result = await addFormDataAPI({
...
...
Please
register
or
login
to post a comment