diff --git a/src/components/charts/G2/components/Line/base.vue b/src/components/charts/G2/components/Line/base.vue index dcc4fef9..b6d2c22d 100644 --- a/src/components/charts/G2/components/Line/base.vue +++ b/src/components/charts/G2/components/Line/base.vue @@ -9,22 +9,6 @@ export default { mixins: [ G2 ], - // 公用参数在 G2 mixin 中 - // 这个组件特有的参数添加在这里 - props: { - // 横轴字段名 - keyNameX: { - type: String, - required: false, - default: 'x' - }, - // 纵轴字段名 - keyNameY: { - type: String, - required: false, - default: 'y' - } - }, methods: { // 初始化图表 init () { diff --git a/src/mock/chart/G2Line.js b/src/mock/chart/G2Line.js index 696b2284..dd186182 100644 --- a/src/mock/chart/G2Line.js +++ b/src/mock/chart/G2Line.js @@ -18,8 +18,8 @@ Mock.mock('/api/chart/G2Line', 'post', ({body, type, url}) => { case 'base': { let lastValue = 0 const year = ['1991', '1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999'] - const data = year.map(y => ({ - year: y, + const data = year.map(e => ({ + year: e, value: 0 })).map(e => { e.value = lastValue + r() @@ -31,8 +31,8 @@ Mock.mock('/api/chart/G2Line', 'post', ({body, type, url}) => { } case 'step': { const month = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'] - const data = month.map(y => ({ - month: y, + const data = month.map(e => ({ + month: e, value: 0 })).map(e => { e.value = r()