当前位置:网站首页>[echart] resize lodash 实现窗口缩放时图表自适应
[echart] resize lodash 实现窗口缩放时图表自适应
2022-07-05 15:49:00 【533_】
<template>
<div ref="chart" class="chart" />
</template>
import echarts from 'echarts';
import {
debounce } from 'lodash';
echarts里面的resize() + 节流
data() {
return {
chart:null
};
},
mounted() {
this.init();
// lodash.debounce 防抖
this.resizeHandler = debounce(() => {
if (this.chart) {
this.chart.resize();
}
}, 100);
// 监听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);
},
},
边栏推荐
- You should have your own persistence
- 对象和类的关系
- 企业级备份软件Veritas NetBackup(NBU) 8.1.1服务端的安装部署
- Defining strict standards, Intel Evo 3.0 is accelerating the upgrading of the PC industry
- Clock switching with multiple relationship
- 效果编辑器新版上线!3D渲染、加标注、设置动画,这次一个编辑器就够了
- Mongodb getting started Tutorial Part 04 mongodb client
- Migrate /home partition
- Flet教程之 11 Row组件在水平数组中显示其子项的控件 基础入门(教程含源码)
- 事务回滚异常
猜你喜欢
18.[stm32] read the ROM of DS18B20 temperature sensor and realize multi-point temperature measurement
2020-2022 two-year anniversary of creation
今日睡眠质量记录79分
The new version of effect editor is online! 3D rendering, labeling, and animation, this time an editor is enough
Use of RLOCK lock
Replknet: it's not that large convolution is bad, but that convolution is not large enough. 31x31 convolution. Let's have a look at | CVPR 2022
项目sql中批量update的时候参数类型设置错误
单商户 V4.4,初心未变,实力依旧!
RLock锁的使用
list去重并统计个数
随机推荐
EDI许可证和ICP经营性证有什么区别
Mistakes made when writing unit tests
PSPNet | 语义分割及场景分析
研发效能度量指标构成及效能度量方法论
The difference between abstract classes and interfaces
漫画:什么是服务熔断?
抽象类和接口的区别
2020-2022两周年创作纪念日
Six common transaction solutions, you sing, I come on stage (no best, only better)
ES6深入—ES6 Generator 函数
单商户 V4.4,初心未变,实力依旧!
Single merchant v4.4 has the same original intention and strength!
Flet教程之 11 Row组件在水平数组中显示其子项的控件 基础入门(教程含源码)
对象和类的关系
一键安装脚本实现快速部署GrayLog Server 4.2.10单机版
今日睡眠质量记录79分
【漏洞预警】CVE-2022-26134 Confluence 远程代码执行漏洞POC验证与修复过程
Defining strict standards, Intel Evo 3.0 is accelerating the upgrading of the PC industry
HiEngine:可媲美本地的云原生内存数据库引擎
Seaborn绘制11个柱状图