From 98b94622c8916934666c6880dc9b3ded0ea8c379 Mon Sep 17 00:00:00 2001 From: quietcoder <1642965215@qq.com> Date: Sun, 25 Jun 2017 22:06:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9AinitOptions=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9=EF=BC=8C=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=20devicePixelRatio=20=E7=AD=89=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/props.md | 1 + examples/pages/toggle.vue | 7 ++++++- package.json | 2 +- src/mixins.js | 5 +++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/props.md b/docs/props.md index 994fb8e..17cbe98 100644 --- a/docs/props.md +++ b/docs/props.md @@ -25,6 +25,7 @@ V-Charts 的属性分为两种,一种是全部图表都具有的属性,例 | mark-area | 图表标线 | Object | 配置项内容对应echarts中关于markArea的部分
使用时需额外引入对应模块
`import 'echarts/lib/component/markAreae'` | | visualMap | 视觉映射组件 | Array, Object | 内容参考
http://echarts.baidu.com/option.html#visualMap
使用时需额外引入对应模块
`import 'echarts/lib/component/visualMap'` | | dataZoom | 视觉映射组件 | Array, Object | 内容参考
http://echarts.baidu.com/option.html#dataZoom
使用时需额外引入对应模块
`import 'echarts/lib/component/dataZoom'` | +| initOptions | init 附加参数 | Object | 内容参考
http://echarts.baidu.com/api.html#echarts.init | 另外一种是图表自身的属性,比如用户设置数据类型的`dataType`,这样的属性被置于settings内,每种图表的配置项不完全相同,具体参数参考下述图表文档中的配置项 diff --git a/examples/pages/toggle.vue b/examples/pages/toggle.vue index a52b582..f32cec8 100644 --- a/examples/pages/toggle.vue +++ b/examples/pages/toggle.vue @@ -2,11 +2,13 @@

图表切换

{{ contentList[0] }}

- @@ -82,6 +84,9 @@ export default { type: 'pie' } ] + this.initOptions = { + devicePixelRatio: 1 + } return { currentValue: '', chartData: {}, diff --git a/package.json b/package.json index 04c1b6e..0692eee 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "v-charts", - "version": "1.2.2", + "version": "1.2.3", "description": "", "main": "lib/index.js", "scripts": { diff --git a/src/mixins.js b/src/mixins.js index 7b01a2f..954305a 100644 --- a/src/mixins.js +++ b/src/mixins.js @@ -16,7 +16,8 @@ const chartMixin = { markArea: { type: Object }, markPoint: { type: Object }, visualMap: { type: [Object, Array] }, - dataZoom: { type: [Object, Array] } + dataZoom: { type: [Object, Array] }, + initOptions: { type: Object, default () { return {} } } }, watch: { @@ -107,7 +108,7 @@ const chartMixin = { init () { if (this.echarts) return - this.echarts = this.echartsLib.init(this.$refs.canvas, 've-chart') + this.echarts = this.echartsLib.init(this.$refs.canvas, 've-chart', this.initOptions) if (this.data) this.dataHandler(this.data) if (this.events) this.bindEvents() },