directives: {
resize: {
bind (el, binding) {
let width = '', height = '';
function isReize () {
const style = document.defaultView.getComputedStyle(el);
if (width !== style.width || height !== style.height) {
binding.value();
}
width = style.width;
height = style.height;
}
el.__vueSetInterval__ = setInterval(isReize, 300);
},
unbind (el) {
clearInterval(el.__vueSetInterval__);
}
}
},
methods: {
resize() {
const lineChart = this.$echarts.init(this.$refs.draw_communication_team);
if (lineChart) {
lineChart.resize()
}
},
}
<div v-resize="resize" ref="draw_communication_team" class="bottom_charts">
</div>