fix:scEcharts组件完善

This commit is contained in:
shijing 2024-12-24 14:41:29 +08:00
parent 4d414f1fcf
commit 5c43ebba31
1 changed files with 3 additions and 2 deletions

View File

@ -3,6 +3,7 @@
</template>
<script>
import { markRaw } from 'vue';
import * as echarts from 'echarts';
import T from './echarts-theme-T.js';
echarts.registerTheme('T', T);
@ -31,7 +32,7 @@
if(that.myChart!==null){
that.myChart.setOption(v);
}else{
let myChart = echarts.init(that.$refs.scEcharts, 'T');
let myChart = markRaw(echarts.init(that.$refs.scEcharts, 'T'));
myChart.setOption(v);
that.myChart = myChart;
}
@ -62,7 +63,7 @@
},
methods: {
draw(){
var myChart = echarts.init(this.$refs.scEcharts, 'T');
var myChart = markRaw(echarts.init(this.$refs.scEcharts, 'T'));
myChart.setOption(this.myOptions);
this.myChart = myChart;
window.addEventListener('resize', () => myChart.resize());