Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在v-echart或者echarts封装的组件中,如何实现布局改变触发重绘 #120

Closed
evan-lin9 opened this issue Jul 9, 2017 · 4 comments

Comments

@evan-lin9
Copy link

就好比这个element-admin,在图表页是,收缩和展开侧边栏导航,不会触发window.resize

@ttop5
Copy link
Contributor

ttop5 commented Jul 9, 2017

将侧边导航栏的收缩和展开的状态存入vuex中,然后watch这个状态,状态一发生改变就重绘图表即可哈 @SkyLin0909

@evan-lin9
Copy link
Author

主要是我没自己封装echarts,而是选择直接用v-echart。看了下源码是在mixin里面监听resize。直接引用这个组件就不是很清楚如何去重绘了

@ttop5
Copy link
Contributor

ttop5 commented Jul 10, 2017

ecomfe/vue-echarts#18

这里有人问过同样的问题。我的建议是自己封装,挺简单的,而且接口可以根据自己的项目灵活设计多好啊。:bowtie: @SkyLin0909

@PanJiaChen
Copy link
Owner

PanJiaChen commented Jul 10, 2017

@SkyLin0909 侧边栏这个还真不太好做, 不是watch 侧边栏状态变化就能解决的。因为侧边栏有动画,所以监听状态变化之后去resize是不行的,4ad9040 我这里修改了一下。不过这种需求就和业务强耦合了。
详细代码 https://github.com/PanJiaChen/vue-element-admin/blob/master/src/views/dashboard/editor/lineChart.vue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants