Skip to content

Commit bf772c1

Browse files
committed
fix: compatible with vue 2
1 parent ad88667 commit bf772c1

File tree

32 files changed

+109
-31
lines changed

32 files changed

+109
-31
lines changed

src/plots/area/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { Area, AreaOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type AreaChartProps = Writeable<
78
Omit<BaseChartProps<AreaOptions>, 'chart'> & AreaOptions
@@ -10,7 +11,7 @@ export type AreaChartProps = Writeable<
1011
const AreaChart = defineComponent<AreaChartProps>({
1112
name: 'AreaChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Area} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Area} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/bar/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { Bar, BarOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type BarChartProps = Writeable<
78
Omit<BaseChartProps<BarOptions>, 'chart'> & BarOptions
@@ -10,7 +11,7 @@ export type BarChartProps = Writeable<
1011
const BarChart = defineComponent<BarChartProps>({
1112
name: 'BarChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Bar} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Bar} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/bidirectional-bar/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { BidirectionalBar, BidirectionalBarOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type BidirectionalBarChartProps = Writeable<
78
Omit<BaseChartProps<BidirectionalBarOptions>, 'chart'> &
@@ -12,7 +13,7 @@ const BidirectionalBarChart = defineComponent<BidirectionalBarChartProps>({
1213
name: 'BidirectionalBarChart',
1314
setup: (props, ctx) => {
1415
return () => (
15-
<BaseChart chart={BidirectionalBar} {...ctx.attrs} {...props} />
16+
<BaseChart chart={BidirectionalBar} {...mergeAttrs(props, ctx.attrs)} />
1617
)
1718
},
1819
})

src/plots/box/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { Box, BoxOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type BoxChartProps = Writeable<
78
Omit<BaseChartProps<BoxOptions>, 'chart'> & BoxOptions
@@ -10,7 +11,7 @@ export type BoxChartProps = Writeable<
1011
const BoxChart = defineComponent<BoxChartProps>({
1112
name: 'BoxChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Box} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Box} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/bullet/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { Bullet, BulletOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type BulletChartProps = Writeable<
78
Omit<BaseChartProps<BulletOptions>, 'chart'> & BulletOptions
@@ -10,7 +11,7 @@ export type BulletChartProps = Writeable<
1011
const BulletChart = defineComponent<BulletChartProps>({
1112
name: 'BulletChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Bullet} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Bullet} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/chord/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { Chord, ChordOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type ChordChartProps = Writeable<
78
Omit<BaseChartProps<ChordOptions>, 'chart'> & ChordOptions
@@ -10,7 +11,7 @@ export type ChordChartProps = Writeable<
1011
const ChordChart = defineComponent<ChordChartProps>({
1112
name: 'ChordChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Chord} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Chord} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/column/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Column, ColumnOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type ColumnChartProps = Writeable<
78
Omit<BaseChartProps<ColumnOptions>, 'chart'> & ColumnOptions
@@ -10,7 +11,7 @@ export type ColumnChartProps = Writeable<
1011
const ColumnChart = defineComponent<ColumnChartProps>({
1112
name: 'ColumnChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Column} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Column} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/dual-axes/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { App, defineComponent } from 'vue-demi'
22
import { DualAxes, DualAxesOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type DualAxesChartProps = Writeable<
78
Omit<BaseChartProps<DualAxesOptions>, 'chart'> & DualAxesOptions
@@ -10,7 +11,9 @@ export type DualAxesChartProps = Writeable<
1011
const DualAxesChart = defineComponent<DualAxesChartProps>({
1112
name: 'DualAxesChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={DualAxes} {...ctx.attrs} {...props} />
14+
return () => (
15+
<BaseChart chart={DualAxes} {...mergeAttrs(props, ctx.attrs)} />
16+
)
1417
},
1518
})
1619

src/plots/funnel/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Funnel, FunnelOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type FunnelChartProps = Writeable<
78
Omit<BaseChartProps<FunnelOptions>, 'chart'> & FunnelOptions
@@ -10,7 +11,7 @@ export type FunnelChartProps = Writeable<
1011
const FunnelChart = defineComponent<FunnelChartProps>({
1112
name: 'FunnelChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Funnel} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Funnel} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/gauge/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent, App } from 'vue-demi'
22
import { Gauge, GaugeOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type GaugeChartProps = Writeable<
78
Omit<BaseChartProps<GaugeOptions>, 'chart'> & GaugeOptions
@@ -10,7 +11,7 @@ export type GaugeChartProps = Writeable<
1011
const GaugeChart = defineComponent<GaugeChartProps>({
1112
name: 'GaugeChart',
1213
setup: (props, ctx) => {
13-
return () => <BaseChart chart={Gauge} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Gauge} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

0 commit comments

Comments
 (0)