omip - delete obj key when value is undefined

This commit is contained in:
dntzhang 2019-03-29 12:53:18 +08:00
parent d94c0b989d
commit 2783ad7284
3 changed files with 18 additions and 0 deletions

View File

@ -19,6 +19,12 @@ class Component {
console.log(e)
}
for (let key in this.data) {
if (this.data[key] === undefined) {
delete this.data[key]
}
}
if (arguments.length === 0) {
this.$scope.setData(this.data)
} else if (arguments.length === 1) {

View File

@ -19,6 +19,12 @@ class Component {
console.log(e)
}
for (let key in this.data) {
if (this.data[key] === undefined) {
delete this.data[key]
}
}
if (arguments.length === 0) {
this.$scope.setData(this.data)
} else if (arguments.length === 1) {

View File

@ -19,6 +19,12 @@ class Component {
console.log(e)
}
for (let key in this.data) {
if (this.data[key] === undefined) {
delete this.data[key]
}
}
if (arguments.length === 0) {
this.$scope.setData(this.data)
} else if (arguments.length === 1) {