diff --git a/src/components/CustomChart/index.vue b/src/components/CustomChart/index.vue index 8dac754..44a3a22 100644 --- a/src/components/CustomChart/index.vue +++ b/src/components/CustomChart/index.vue @@ -5,22 +5,22 @@ import * as echarts from 'echarts' import 'echarts-gl' -const events = ['click', 'brushEnd'] +const events = ['click', 'brushEnd', 'dataZoom'] const zrEvents = ['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick', 'contextmenu'] export default { props: { option: { type: Object, - default: () => ({}) + default: () => ({}), }, opts: { type: Object, - default: () => {} + default: () => {}, }, height: { type: Number, - default: null - } + default: null, + }, }, data() { return {} @@ -31,21 +31,21 @@ export default { this.initEventListener() }, destroyed() { - if(this._chart) { + if (this._chart) { this._chart.dispose() } }, methods: { initEventListener() { - events.forEach(eventName => { + events.forEach((eventName) => { this._chart.on(eventName, (params) => { this.$emit(eventName, params) }) }) const zr = this.getZRender() - zrEvents.forEach(eventName => { - zr.on(eventName, params => { + zrEvents.forEach((eventName) => { + zr.on(eventName, (params) => { this.$emit(`zr:${eventName}`, params) }) }) @@ -62,7 +62,7 @@ export default { getZRender() { return this._chart.getZr() - } + }, }, watch: { option: { @@ -71,14 +71,14 @@ export default { this._chart.setOption(this.option, this.opts) } }, - deep: true + deep: true, }, height() { this.$nextTick(() => { this._chart && this._chart.resize() }) - } - } + }, + }, }