Skip to content

Commit

Permalink
feat(core): add log prop to comp
Browse files Browse the repository at this point in the history
  • Loading branch information
xiguaxigua committed Aug 21, 2018
1 parent f172e54 commit 7abca27
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/en/props.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ All charts have properties such as `width`, `events` and so on.
| change-delay | delay of chart redraw callback while props change | number | 0 |
| set-option-opts | the second parameter of echarts setOption, [doc](http://echarts.baidu.com/api.html#echartsInstance.setOption) | boolean<br>object | true |
| not-set-unchange | Don't participate in setOption if it doesn't change | array | - |
| log | console log echarts options | boolean | false |

?> When using the dataZoom component, changes to the data will cause the dataZoom to be reset. Setting `:not-set-unchange="['dataZoom']"` on the component will solve the problem.

Expand Down
1 change: 1 addition & 0 deletions docs/props.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
| change-delay | 属性修改触发图表重绘回调的延迟 | number | 0 |
| set-option-opts | echarts setOption 的第二个参数, [参考文档](http://echarts.baidu.com/api.html#echartsInstance.setOption) | boolean<br>object | true |
| not-set-unchange | 未发生变化时不参加 setOption 的属性 | array | - |
| log | 在控制台打印内部生成的echarts options | boolean | false |

?> 在使用 dataZoom 组件时,数据发生改变会引起 dataZoom 的重置,在组件上设置 `:not-set-unchange="['dataZoom']"` 即可解决这个问题。

Expand Down
4 changes: 3 additions & 1 deletion src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export default {
changeDelay: { type: Number, default: 0 },
setOptionOpts: { type: [Boolean, Object], default: true },
cancelResizeCheck: Boolean,
notSetUnchange: Array
notSetUnchange: Array,
log: Boolean
},

watch: {
Expand Down Expand Up @@ -244,6 +245,7 @@ export default {
}
}
if (this._isDestroyed) return
if (this.log) console.log(options)
this.echarts.setOption(options, setOptionOpts)
this.$emit('ready', this.echarts, options, echartsLib)
if (!this._once['ready-once']) {
Expand Down

0 comments on commit 7abca27

Please sign in to comment.