1- import { defineComponent , Ref } from 'vue-demi'
21import { Plot as BasePlot } from '@antv/g2plot'
3- import isEqual from 'lodash/isEqual'
42import isEmpty from 'lodash/isEmpty'
3+ import isEqual from 'lodash/isEqual'
54import { HTMLAttributes } from 'vue'
5+ import { defineComponent , Ref } from 'vue-demi'
66
77interface Options {
88 [ x : string ] : any
@@ -16,8 +16,7 @@ type PickedAttrs = 'class' | 'style'
1616
1717type Data = Record < string , any > [ ] | Record < string , any >
1818
19- export interface BaseChartProps < C extends Options >
20- extends Pick < HTMLAttributes , PickedAttrs > {
19+ export interface BaseChartProps < C extends Options > extends Pick < HTMLAttributes , PickedAttrs > {
2120 chart : any
2221 data : Data
2322 chartRef ?: Ref < BasePlot < C > | null >
@@ -34,16 +33,12 @@ export interface BaseChartRawBindings<C extends Options> {
3433 plot : BasePlot < C >
3534}
3635
37- const BaseChart = defineComponent <
38- BaseChartProps < any > ,
39- BaseChartRawBindings < any > ,
40- ComputedOptions < any >
41- > ( {
36+ const BaseChart = defineComponent < BaseChartProps < any > , BaseChartRawBindings < any > , ComputedOptions < any > > ( {
4237 inheritAttrs : false ,
4338 name : 'BaseChart' ,
4439 computed : {
4540 attrConfig ( ) {
46- return this . $attrs
41+ return { ... this . $attrs }
4742 } ,
4843 chartData ( ) {
4944 const { data } = this . attrConfig
@@ -65,8 +60,7 @@ const BaseChart = defineComponent<
6560 } ,
6661 } ,
6762 mounted ( ) {
68- const chartRef = this . $attrs
69- . chartRef as unknown as Ref < BasePlot < any > | null >
63+ const chartRef = this . $attrs . chartRef as unknown as Ref < BasePlot < any > | null >
7064 const { chart : Chart , onReady } = this . attrConfig
7165 const plot = new Chart ( this . $el as HTMLElement , {
7266 data : this . chartData ,
0 commit comments