Commit 39a1acde by xinla

watch array deep

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