当前位置:网站首页>[echart] resize lodash to realize chart adaptation when window is zoomed
[echart] resize lodash to realize chart adaptation when window is zoomed
2022-07-05 16:28:00 【533_】
<template>
<div ref="chart" class="chart" />
</template>
import echarts from 'echarts';
import {
debounce } from 'lodash';
echarts Inside resize() + throttle
data() {
return {
chart:null
};
},
mounted() {
this.init();
// lodash.debounce Shake proof
this.resizeHandler = debounce(() => {
if (this.chart) {
this.chart.resize();
}
}, 100);
// monitor resize
window.addEventListener('resize', this.resizeHandler);
},
beforeDestroy() {
window.removeEventListener('resize', this.resizeHandler);
},
methods: {
init() {
this.chart = echarts.init(this.$refs.chart);
const option = {
......
};
this.chart.setOption(option);
},
},
Use echarts.resize() Realize chart adaptation when window is zoomed
边栏推荐
- RLock锁的使用
- ES6 deep - ES6 class class
- How can programmers improve their situation?
- 【漏洞预警】CVE-2022-26134 Confluence 远程代码执行漏洞POC验证与修复过程
- Some cognitive thinking
- 2020-2022两周年创作纪念日
- One click installation script enables rapid deployment of graylog server 4.2.10 stand-alone version
- You should have your own persistence
- "21 days proficient in typescript-3" - install and build a typescript development environment md
- abstract关键字和哪些关键字会发生冲突呢
猜你喜欢
随机推荐
搜索 正排索引 和 倒排索引 区别
Dare not buy thinking
漫画:什么是八皇后问题?
【深度学习】深度学习如何影响运筹学?
ES6深入—async 函数 与 Symbol 类型
【学术相关】多位博士毕业去了三四流高校,目前惨不忍睹……
[vulnerability warning] cve-2022-26134 conflict Remote Code Execution Vulnerability POC verification and repair process
Cartoon: what is the eight queens problem?
sql中查询最近一条记录
单商户 V4.4,初心未变,实力依旧!
The memory of a Zhang
Domestic API management artifact used by the company
视觉体验全面升级,豪威集团与英特尔Evo 3.0共同加速PC产业变革
Coding devsecops helps financial enterprises run out of digital acceleration
Background system sending verification code function
This article takes you through the addition, deletion, modification and query of JS processing tree structure data
Win11提示无法安全下载软件怎么办?Win11无法安全下载软件
Win11如何给应用换图标?Win11给应用换图标的方法
Desci: is decentralized science the new trend of Web3.0?
Single merchant v4.4 has the same original intention and strength!









