当前位置:网站首页>[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);
},
},
边栏推荐
- Quick completion guide for manipulator (IX): forward kinematics analysis
- Seaborn draws 11 histograms
- 视觉体验全面升级,豪威集团与英特尔Evo 3.0共同加速PC产业变革
- 20. [stm32] realize the function of intelligent garbage can by using ultrasonic module and steering gear
- 漫画:什么是服务熔断?
- Defining strict standards, Intel Evo 3.0 is accelerating the upgrading of the PC industry
- 一文带你吃透js处理树状结构数据的增删改查
- Intelligent metal detector based on openharmony
- 研发效能度量指标构成及效能度量方法论
- Seaborn绘制11个柱状图
猜你喜欢
超分辨率技术在实时音视频领域的研究与实践
list去重并统计个数
Cs231n notes (top) - applicable to 0 Foundation
Reduce the cost by 40%! Container practice of redis multi tenant cluster
Five common negotiation strategies of consulting companies and how to safeguard their own interests
The difference between abstract classes and interfaces
CISP-PTE之PHP伪协议总结
单商户 V4.4,初心未变,实力依旧!
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
Example project: simple hexapod Walker
随机推荐
18.[stm32] read the ROM of DS18B20 temperature sensor and realize multi-point temperature measurement
2020-2022两周年创作纪念日
详解SQL中Groupings Sets 语句的功能和底层实现逻辑
Quick completion guide for manipulator (IX): forward kinematics analysis
【网易云信】超分辨率技术在实时音视频领域的研究与实践
后台系统发送验证码功能
详解SQL中Groupings Sets 语句的功能和底层实现逻辑
Five common negotiation strategies of consulting companies and how to safeguard their own interests
Defining strict standards, Intel Evo 3.0 is accelerating the upgrading of the PC industry
10分钟帮你搞定Zabbix监控平台告警推送到钉钉群
定义严苛标准,英特尔Evo 3.0正在加速PC产业升级
10 minutes to help you get ZABBIX monitoring platform alarm pushed to nail group
抽象类和接口的区别
单商户 V4.4,初心未变,实力依旧!
[vulnerability warning] cve-2022-26134 conflict Remote Code Execution Vulnerability POC verification and repair process
新春限定丨“牛年忘烦”礼包等你来领~
tf.sequence_mask函数讲解案例
数据湖(十四):Spark与Iceberg整合查询操作
16. [stm32] starting from the principle, I will show you the DS18B20 temperature sensor - four digit digital tube displays the temperature
漫画:什么是蓝绿部署?