实现宽度自适应语句:
//实现自适应部分
window.onresize = () => {
// 基于准备好的dom,初始化echarts实例
let myChart = this.$echarts.init(document.getElementById('newEcharts'));
myChart.resize();
};
代码使用如下:
<template>
<el-row>
<el-col :xs="24" :sm="24" :md="24" :lg="24">
<div id="newEcharts" style="width:100%;height:400px;padding-top:40px"></div>
</el-col>
</el-row>
</template>
<script>
export default {
data() {
return {
newVisible: false,
newDialogFormVisible: false,
};
},
mounted () {
this.initEcharts()
//实现自适应部分
window.onresize = () => {
/