File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
src/views/dashboard/admin/components Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,7 @@ export default {
3333 },
3434 data () {
3535 return {
36- chart: null ,
37- sidebarElm: null
36+ chart: null
3837 }
3938 },
4039 watch: {
@@ -58,6 +57,10 @@ export default {
5857 this .chart = null
5958 },
6059 methods: {
60+ initChart () {
61+ this .chart = echarts .init (this .$el , ' macarons' )
62+ this .setOptions (this .chartData )
63+ },
6164 setOptions ({ expectedData, actualData } = {}) {
6265 this .chart .setOption ({
6366 xAxis: {
@@ -126,10 +129,6 @@ export default {
126129 animationEasing: ' quadraticOut'
127130 }]
128131 })
129- },
130- initChart () {
131- this .chart = echarts .init (this .$el , ' macarons' )
132- this .setOptions (this .chartData )
133132 }
134133 }
135134}
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ export default {
1414 this . $_destroyResizeEvent ( )
1515 this . $_destroySidebarResizeEvent ( )
1616 } ,
17+ // to fixed bug when cached by keep-alive
18+ // https://github.com/PanJiaChen/vue-element-admin/issues/2116
1719 activated ( ) {
1820 this . $_initResizeEvent ( )
1921 this . $_initSidebarResizeEvent ( )
@@ -25,11 +27,6 @@ export default {
2527 methods : {
2628 // use $_ for mixins properties
2729 // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
28- $_sidebarResizeHandler ( e ) {
29- if ( e . propertyName === 'width' ) {
30- this . $_resizeHandler ( )
31- }
32- } ,
3330 $_resizeHandler ( ) {
3431 return debounce ( ( ) => {
3532 if ( this . chart ) {
@@ -43,6 +40,11 @@ export default {
4340 $_destroyResizeEvent ( ) {
4441 window . removeEventListener ( 'resize' , this . $_resizeHandler )
4542 } ,
43+ $_sidebarResizeHandler ( e ) {
44+ if ( e . propertyName === 'width' ) {
45+ this . $_resizeHandler ( )
46+ }
47+ } ,
4648 $_initSidebarResizeEvent ( ) {
4749 this . $_sidebarElm = document . getElementsByClassName ( 'sidebar-container' ) [ 0 ]
4850 this . $_sidebarElm && this . $_sidebarElm . addEventListener ( 'transitionend' , this . $_sidebarResizeHandler )
You can’t perform that action at this time.
0 commit comments