当前位置:网站首页>[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);
},
},
边栏推荐
- Is it safe for Guotai Junan to open an account online
- sql中set标签的使用
- Data Lake (XIV): spark and iceberg integrated query operation
- This article takes you through the addition, deletion, modification and query of JS processing tree structure data
- Research and development efficiency measurement index composition and efficiency measurement methodology
- Cheer yourself up
- 五种常见的咨询公司谈判策略以及如何维护自己的利益
- 定义严苛标准,英特尔Evo 3.0正在加速PC产业升级
- Defining strict standards, Intel Evo 3.0 is accelerating the upgrading of the PC industry
- 2020-2022两周年创作纪念日
猜你喜欢
2020-2022两周年创作纪念日
Six common transaction solutions, you sing, I come on stage (no best, only better)
《21天精通TypeScript-3》-安装搭建TypeScript开发环境.md
CISP-PTE之SQL注入(二次注入的应用)
Single merchant v4.4 has the same original intention and strength!
Cs231n notes (medium) -- applicable to 0 Foundation
ES6 drill down - Async functions and symbol types
obj集合转为实体集合
Convert obj set to entity set
Mistakes made when writing unit tests
随机推荐
记一次'非常诡异'的云安全组规则问题排查过程
Dataarts studio data architecture - Introduction to data standards
10分钟帮你搞定Zabbix监控平台告警推送到钉钉群
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
Codasip adds verify safe startup function to risc-v processor series
给自己打打气
公司自用的国产API管理神器
漫画:什么是蓝绿部署?
Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
写单元测试的时候犯的错
Cs231n notes (top) - applicable to 0 Foundation
《21天精通TypeScript-3》-安装搭建TypeScript开发环境.md
抽象类中子类与父类
Clock switching with multiple relationship
Relationship between objects and classes
【学术相关】多位博士毕业去了三四流高校,目前惨不忍睹……
This article takes you through the addition, deletion, modification and query of JS processing tree structure data
定义严苛标准,英特尔Evo 3.0正在加速PC产业升级
迁移/home分区
The memory of a Zhang