Skip to content

Commit 98fee07

Browse files
authored
fix: fix MixChart and MultiViewChart (#256)
* fix: fix MixChart for Vue 2 Use `mergeAttrs` to merge props and attrs * fix: remove data in MixChartProps/MultiViewChartProps
1 parent 4b0a2c3 commit 98fee07

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

__tests__/plots/mix.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import { mount } from '@vue/test-utils'
22
import MixChart from '../../src/plots/mix'
33

44
const config = {
5-
data: [],
6-
xField: 'a',
7-
yField: 'b',
5+
plots: [],
86
}
97

108
describe('MixChart', () => {

__tests__/plots/multi-view.spec.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import { mount } from '@vue/test-utils'
22
import MultiViewChart from '../../src/plots/multi-view'
33

44
const config = {
5-
data: [],
6-
xField: 'a',
7-
yField: 'b',
5+
plots: [],
86
}
97

108
describe('MultiViewChart', () => {

scripts/sync.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export type ${chart}ChartProps = Writeable<Omit<BaseChartProps<${chart}Options>,
7676
const ${chart}Chart = defineComponent<${chart}ChartProps>({
7777
name: '${chart}Chart',
7878
setup(props, ctx) {
79-
return () => <BaseChart chart={${chart}} {...ctx.attrs} {...props} />
79+
return () => <BaseChart chart={${chart}} {...mergeAttrs(props, ctx.attrs)} />
8080
},
8181
})
8282

src/plots/mix/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import { App, defineComponent } from 'vue-demi'
22
import { Mix, MixOptions } from '@antv/g2plot'
33
import BaseChart, { BaseChartProps } from '../../components/base'
44
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
56

67
export type MixChartProps = Writeable<
7-
Omit<BaseChartProps<MixOptions>, 'chart'> & MixOptions
8+
Omit<BaseChartProps<MixOptions>, 'chart' | 'data'> & MixOptions
89
>
910

1011
const MixChart = defineComponent<MixChartProps>({
1112
name: 'MixChart',
1213
setup(props, ctx) {
13-
return () => <BaseChart chart={Mix} {...ctx.attrs} {...props} />
14+
return () => <BaseChart chart={Mix} {...mergeAttrs(props, ctx.attrs)} />
1415
},
1516
})
1617

src/plots/multi-view/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Writeable } from '../../types'
55
import { mergeAttrs } from '../../utils'
66

77
export type MultiViewChartProps = Writeable<
8-
Omit<BaseChartProps<MixOptions>, 'chart'> & MixOptions
8+
Omit<BaseChartProps<MixOptions>, 'chart' | 'data'> & MixOptions
99
>
1010

1111
/**

0 commit comments

Comments
 (0)