别的页面用这种方法就可以,这个页面就不行(都是多图表页面)
<div class="body">
<Echart :options="options" id="bottomLeftChart" height="100%" width="100%"></Echart>
</div>
<style lang="scss" scoped>
.body {
width: 920px;
height: 380px;
}
</style>
watch: {
cdata: {
handler(newData) {
this.options = {
//。。。。。
};
window.addEventListener("resize", function() {
this.options.resize();
});
},
immediate: true,
deep: true,
},
},
不能直接写
https://www.codeleading.com/article/19172388540/
你这个Echart 组件是你自己封装的还是,用的别人的库,如果是别人的库,那你看看别人的文档里面有没有写怎么设置大小。如果是你自己封装的,那你就style设置他的大小为100%,不要直接写width。