赞
踩
- onMounted(() => {
- setTimeout(() => {
- // this.myCharts();
- const resizeOb = new ResizeObserver((entries) => {
- for (const entry of entries) {
- echarts.getInstanceByDom(entry.target).resize();
- }
- });
- resizeOb.observe(followUpEchart.value);
- });
- });
监听某一个DOM节点的变化,这种变化包括但不仅限于:
- const resizeOb = new ResizeObserver((entries) => {
- for (const entry of entries) {
- //写入要监听的内容
- //echarts.getInstanceByDom(entry.target).resize();
- }
- });
- //传入需要监听的DOM元素
- resizeOb.observe(followUpEchart.value);
-
-
- //取消监听某个DOM节点
- unobserve()
- //例如 1 秒后取消
- setTimeout(() => {
- resizeOb.unobserve(followUpEchart.value);
- }, 1000);
-
-
- //取消对所有节点的监听
- disconnect()
- //例如 1 秒后取消
- setTimeout(() => {
- resizeOb.disconnect(followUpEchart.value);
- }, 1000);

赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。