修改兼容性

master
suixy 2 months ago
parent 09dddb593d
commit b3eae613f3

@ -38,6 +38,9 @@ const setData = (e) => {
option.value = e; option.value = e;
initChart(e); initChart(e);
}; };
const on = (a, b) => {
chart.value.on(a, b);
};
const initChart = (option) => { const initChart = (option) => {
if (!chart.value) { if (!chart.value) {
chart.value = echarts.init(chartRef.value, 'macarons'); chart.value = echarts.init(chartRef.value, 'macarons');
@ -64,6 +67,7 @@ onBeforeUnmount(() => {
window.removeEventListener('resize', resize); window.removeEventListener('resize', resize);
}); });
defineExpose({ defineExpose({
setData setData,
on
}); });
</script> </script>

@ -211,7 +211,7 @@ export default {
this.getTreeselect() this.getTreeselect()
this.getTreeMonitorInfo() // this.getTreeMonitorInfo()
this.getList() this.getList()
}, },
watch: { watch: {
@ -321,7 +321,7 @@ export default {
x: 'center' x: 'center'
}, },
grid: { grid: {
top: '15%', top: '40',
bottom: '10%', bottom: '10%',
left: '10%', left: '10%',
right: '3%' right: '3%'
@ -654,11 +654,11 @@ export default {
this.$refs.Chart4.setData(option4)*/ this.$refs.Chart4.setData(option4)*/
/* echarts.connect(this.$refs.Chart1.chart, this.$refs.Chart2.chart, this.$refs.Chart3.chart, this.$refs.Chart4.chart)*/ /* echarts.connect(this.$refs.Chart1.chart, this.$refs.Chart2.chart, this.$refs.Chart3.chart, this.$refs.Chart4.chart)*/
echarts.connect(this.$refs.Chart1.chart) echarts.connect(this.$refs.Chart1.chart)
console.log(this.$refs.Chart1);
this.$refs.Chart1.chart.on('datazoom', (e) => { this.$refs.Chart1.on('datazoom', (e) => {
option.dataZoom[0].start = e.start; option1.dataZoom[0].start = e.start;
option.dataZoom[0].end = e.end; option1.dataZoom[0].end = e.end;
this.$refs.Chart1.setData(option); this.$refs.Chart1.setData(option1);
}); });
/* this.$refs.Chart1.chart.on('datazoom', (e) => { /* this.$refs.Chart1.chart.on('datazoom', (e) => {

Loading…
Cancel
Save