Commit 39a1acde by xinla

watch array deep

1 parent 63032a23
......@@ -90,6 +90,7 @@ export default {
},
watch: {
dateRange: {
deep: true,
handler(newValue, oldValue) {
if (newValue && newValue[0]) {
let date = new Date()
......
......@@ -146,6 +146,7 @@ export default {
this.tableData = JSON.parse(JSON.stringify(val))
},
immediate: true,
deep: true,
},
},
......
......@@ -29,13 +29,16 @@ export default {
},
watch: {
// 日期选择器数据同步至查询参数
dateRange(dateRange) {
if (!dateRange || dateRange.length !== 2) {
this.query.beginTime = ''
this.query.endTime = ''
} else {
;[this.query.beginTime, this.query.endTime] = dateRange
}
dateRange: {
deep: true,
handler(val) {
if (!val || val.length !== 2) {
this.query.beginTime = ''
this.query.endTime = ''
} else {
;[this.query.beginTime, this.query.endTime] = val
}
},
},
},
created() {
......
......@@ -33,13 +33,16 @@ export default {
computed: {},
watch: {
// 日期选择器数据同步至查询参数
dateRange(dateRange) {
if (!dateRange || dateRange.length !== 2) {
this.query.beginTime = ''
this.query.endTime = ''
} else {
;[this.query.beginTime, this.query.endTime] = dateRange
}
dateRange: {
deep: true,
handler(val) {
if (!val || val.length !== 2) {
this.query.beginTime = ''
this.query.endTime = ''
} else {
;[this.query.beginTime, this.query.endTime] = val
}
},
},
},
created() {
......
......@@ -193,25 +193,34 @@ export default {
},
watch: {
// 日期选择器数据同步至查询参数
dateRange(dateRange) {
if (!dateRange || dateRange.length !== 2) {
this.form.cusBeginTime = ''
this.form.cusEndTime = ''
} else {
;[this.form.cusBeginTime, this.form.cusEndTime] = dateRange
}
dateRange: {
deep: true,
handler(val) {
if (!val || val.length !== 2) {
this.form.cusBeginTime = ''
this.form.cusEndTime = ''
} else {
;[this.form.cusBeginTime, this.form.cusEndTime] = val
}
},
},
users(users) {
this.form.scopeList = users.map((user) => {
return user.userId
})
this.$refs.form.validateField('scopeList')
users: {
deep: true,
handler(val) {
this.form.scopeList = val.map((user) => {
return user.userId
})
this.$refs.form.validateField('scopeList')
},
},
tags(tags) {
this.form.tagList = tags.map((tag) => {
return tag.tagId
})
this.$refs.form.validateField('tagList')
tags: {
deep: true,
handler(val) {
this.form.tagList = val.map((tag) => {
return tag.tagId
})
this.$refs.form.validateField('tagList')
},
},
},
created() {
......
......@@ -54,13 +54,16 @@ export default {
},
watch: {
// 日期选择器数据同步至查询参数
dateRange(dateRange) {
if (!dateRange || dateRange.length !== 2) {
this.query.beginTime = ''
this.query.endTime = ''
} else {
;[this.query.beginTime, this.query.endTime] = dateRange
}
dateRange: {
deep: true,
handler(val) {
if (!val || val.length !== 2) {
this.query.beginTime = ''
this.query.endTime = ''
} else {
;[this.query.beginTime, this.query.endTime] = val
}
},
},
dialogVisible(val) {
if (!val) this.$refs['customerForm'].resetFields()
......
......@@ -511,6 +511,7 @@ export default {
// console.log(669, this.mobForm)
},
immediate: true,
deep: true,
},
},
}
......
......@@ -47,6 +47,7 @@ export default {
computed: {},
watch: {
stageList: {
deep: true,
immediate: true,
handler(val) {
if (val) {
......
......@@ -47,6 +47,7 @@ export default {
computed: {},
watch: {
stageList: {
deep: true,
immediate: true,
handler(val) {
if (val) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!