props: {
echartStyle: {
type: Object,
default() {
return {}
}
},
titleText: {
type: String,
default: ''
},
tooltipFormatter: {
type: String,
default: ''
},
opinion: {
type: Array,
default() {
return []
}
},
seriesName: {
type: String,
default: ''
},
opinionData: {
type: Array,
default() {
return []
}
}
}
子组件中使用watch()监听值的改变,不同的类型要用不同的监听方法
watch:{
titleText:function(newValue,oldValue){
this.getChange();
},
echartStyle:{
handler(newValue,oldValue){
this.getChange();
},
deep:true
},
tooltipFormatter:function(newValue,oldValue){
this.getChange();
},
opinion:{
handler(newValue,oldValue){
this.getChange();
},
deep:true //深度监听
},
seriesName:function(newValue,oldValue){
this.getChange();
},
opinionData:{
handler(newValue,oldValue){
this.getChange();
},
deep:true
}
}