Skip to content

Commit 778bdb3

Browse files
committed
修复表单忽略值问题
1 parent da75932 commit 778bdb3

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

public/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=d84a73a821faafc47d53",
2+
"/app.js": "/app.js?id=73eae0e8c76521361e10",
33
"/manifest.js": "/manifest.js?id=8991394a854ee5cdffc3",
44
"/vendor.js": "/vendor.js?id=df0be4950fcb717193ba"
55
}

resources/js/components/form/Form.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,15 @@ export default {
182182
this.$refs[formName].validate((valid) => {
183183
if (valid) {
184184
this.loading = true;
185-
console.log(this.ignoreKey);
186-
const formatData = this._.omit(this.formData, this.attrs.ignoreEmptyProps);
185+
186+
const formatData = this._.pickBy(this.formData, (value, key) => {
187+
return (
188+
!isNull(value) ||
189+
this._.indexOf(this.attrs.ignoreEmptyProps, key) < 0
190+
);
191+
});
192+
193+
187194
if (this.isEdit) {
188195
this.$http
189196
.put(this.attrs.action, formatData)

0 commit comments

Comments
 (0)