props: ['rankName', 'rankRate', 'dateTime'],
watch: {
rankRate: {
handler (newValue, oldValue) {
this.rankRate = newValue
this.getInfoSucc() // 调用echarts
},
deep: true
}
}
本文介绍在Vue项目中如何使用watch来监听特定属性的变化,并通过实例演示了当'rankRate'属性发生变化时,如何调用'getInfoSucc'方法更新echarts图表,实现数据与视图的同步更新。
props: ['rankName', 'rankRate', 'dateTime'],
watch: {
rankRate: {
handler (newValue, oldValue) {
this.rankRate = newValue
this.getInfoSucc() // 调用echarts
},
deep: true
}
}
3032

被折叠的 条评论
为什么被折叠?
