update README
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
### 封装组件渲染图表
|
### 封装组件渲染图表
|
||||||
|
|
||||||
所有的 ECharts 图表都是基于 `common/echart/index.vue` 封装组件创建的,已经对数据和屏幕改动进行了监听,能够动态渲染图表数据和大小。在监听窗口小大的模块,使用了节流函数来节约浏览器性能。
|
所有的 ECharts 图表都是基于 `common/echart/index.vue` 封装组件创建的,已经对数据和屏幕改动进行了监听,能够动态渲染图表数据和大小。在监听窗口小大的模块,使用了防抖函数来控制更新频率,节约浏览器性能。
|
||||||
|
|
||||||
项目配置了默认的 ECharts 图表样式,文件地址:`common/echart/theme.json`。
|
项目配置了默认的 ECharts 图表样式,文件地址:`common/echart/theme.json`。
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ export default {
|
|||||||
for (let i = 0; i < 7; i++) {
|
for (let i = 0; i < 7; i++) {
|
||||||
// 日期
|
// 日期
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
console.log(date.getMonth());
|
|
||||||
console.log(date.getDate());
|
|
||||||
this.cdata.weekCategory.unshift([date.getMonth() + 1, date.getDate()-i].join("/"));
|
this.cdata.weekCategory.unshift([date.getMonth() + 1, date.getDate()-i].join("/"));
|
||||||
|
|
||||||
// 折线图数据
|
// 折线图数据
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @param {Function} fn 函数
|
* @param {Function} fn 防抖函数
|
||||||
* @param {Number} delay 延迟时间
|
* @param {Number} delay 延迟时间
|
||||||
*/
|
*/
|
||||||
export function debounce(fn, delay) {
|
export function debounce(fn, delay) {
|
||||||
|
|||||||
@@ -22,10 +22,9 @@ export default {
|
|||||||
window.removeEventListener('reisze', this[resizeChartMethod]);
|
window.removeEventListener('reisze', this[resizeChartMethod]);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 通过 lodash 的防抖函数来控制 resize 的频率
|
// 防抖函数来控制 resize 的频率
|
||||||
[resizeChartMethod]: debounce(function() {
|
[resizeChartMethod]: debounce(function() {
|
||||||
if (this.chart) {
|
if (this.chart) {
|
||||||
console.log('修改');
|
|
||||||
this.chart.resize();
|
this.chart.resize();
|
||||||
}
|
}
|
||||||
}, 300),
|
}, 300),
|
||||||
|
|||||||
Reference in New Issue
Block a user