//工作中遇到的:
(1)Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "flag"

(1)Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "flag"
原因:子组件直接更改父组件中的属性子组件直接更改父组件中的属性解决办法:无法直接更改可以用$emit()传递参数至父组件中,然后在绑定在子组件中的父组件方法里更改父组件属性
例:
//父组件

//export default --> methods
changeFlag(val){
this.isShow = val;
}
//子组件
this.$emit('on-change-flag', val)
//父组件

//export default --> methods
changeFlag(val){
this.isShow = val;
}
//子组件
this.$emit('on-change-flag', val)//学习中遇到的:(1)echarts中map地图全屏展示出现图型大小不变的问题原因:echarts设置的是这样,但是当全屏的时候,是滞后的,导致全屏之后的容器大小还是之前的大小,需要重置大小echarts设置的是这样,但是当全屏的时候,是滞后的,导致全屏之后的容器大小还是之前的大小,需要重置大小解决办法:
只需要在echarts后面加一段代码就可以解决了,使echarts充满容器
myChart2.setOption({...});

//页面改变时更新echarts容器使其自适应
setTimeout(function (){

window.onresize = function () {

myChart2.resize();

}

},200)
或者添加这个


myChart2.setOption({...});
window.addEventListener("resize",function(){


myChart2.resize();

})
只需要在echarts后面加一段代码就可以解决了,使echarts充满容器
myChart2.setOption({...});

//页面改变时更新echarts容器使其自适应
setTimeout(function (){

window.onresize = function () {

myChart2.resize();

}

},200)
或者添加这个


myChart2.setOption({...});
window.addEventListener("resize",function(){


myChart2.resize();

})