vue watch监听死循环问题,子组件报错[Vue warn]: You may have an infinite update loop in watcher with expression "configure"
//父组件
data(){
ratio_chart: {
yAxisData: [],
curSeriesData: [],
lastSeriesData: []
},
},
methods:{
getData(){
this.$axios.post('xxx',params).then(res => {
let result = res.data
result.map((item) => {
this.ratio_chart.curSeriesData.push(item.total)
this.ratio_chart.lastSeriesData.push(item.lastTotal)
this.ratio_chart.yAxisData.push(item.quesCateName)
})
})
}
}
将ratio_chart传值给子组件configure
<child :configure='ratio_chart'></child>
//child.vue
props: {
configure: {
type: Object,
default () {
return {}
}
},
},
watch: {
configure: {
handler (newVal, oldVal) {
if (newVal) {
this.drawChart()
}
},
deep: true
}
}
控制台子组件报错[Vue warn]: You may have an infinite update loop in watcher with expression "configure"
麻烦问下大家如何解决这个死循环的问题?谢谢