-
Notifications
You must be signed in to change notification settings - Fork 19.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] 同一个页面使用多个画布,会导致重叠在一起,只展示最后一个,独立的id 也设置了 #20604
Comments
@18347272192 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗 TRANSLATEDTITLE [Bug] Using multiple canvases on the same page will cause them to overlap and only the last one will be displayed. Independent IDs are also set. |
If you are passing the same dom element when calling |
没有一样的, const ecBar2 = ref({ |
|
This may be an issue related to your implementation of |
ec-canvas.vue------ <canvas type="2d" class="ec-canvas" :canvas-id="canvasId" @touchstart="touchStart" @touchmove="touchMove" |
Version
5.2.2
Link to Minimal Reproduction
https://echarts.apache.org/examples/zh/editor.html?c=pie-borderRadius
Steps to Reproduce
封装的echart组件
<script lang="js"> import echarts from './echarts.min.js'; import { ref, reactive } from "vue"; import EcCanvas from "./ec-canvas.vue"; export default { components: { EcCanvas }, props: { canvasId: { type: String, default: '' } }, setup(props, { expose, emit }) { const ec = reactive({ lazyLoad: true }); const ecCanvasRef = ref(null); const refresh = (options) => { if (!ecCanvasRef.value) { console.error('ecCanvas未获取到dom'); return; } ecCanvasRef.value?.init((canvas, width, height, canvasDpr) => { const chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: canvasDpr }); canvas.setChart(chart); chart.setOption(options); // 监听图形绘制完成事件 chart.on('finished', () => { emit('send-data', Date.now()) // console.log('图形绘制完成城市分布', props.canvasId, Date.now()); // emit('send-data', Date.now()) // 在这里可以执行你想要的操作,表示图形已经绘制完成 }); return chart; }); }; expose({ refresh, }); return { ec, ecCanvasRef, }; }, }; </script>父组件使用
<script setup> import EChart from 'e-charts.v' </script>Current Behavior
只想页面里同时显示多个echarts ,是我封装的有问题吗
Expected Behavior
正常展示多个echarts
Environment
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: