File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 44
55<script >
66import echarts from ' echarts'
7+ import resize from ' ./mixins/resize'
78
89export default {
10+ mixins: [resize],
911 props: {
1012 className: {
1113 type: String ,
Original file line number Diff line number Diff line change 44
55<script >
66import echarts from ' echarts'
7+ import resize from ' ./mixins/resize'
78
89export default {
10+ mixins: [resize],
911 props: {
1012 className: {
1113 type: String ,
Original file line number Diff line number Diff line change 44
55<script >
66import echarts from ' echarts'
7+ import resize from ' ./mixins/resize'
78
89export default {
10+ mixins: [resize],
911 props: {
1012 className: {
1113 type: String ,
@@ -31,7 +33,6 @@ export default {
3133 },
3234 mounted () {
3335 this .initChart ()
34- this .chart = null
3536 },
3637 beforeDestroy () {
3738 if (! this .chart ) {
Original file line number Diff line number Diff line change 1+ import { debounce } from '@/utils'
2+
3+ export default {
4+ mounted ( ) {
5+ this . __resizeHanlder = debounce ( ( ) => {
6+ if ( this . chart ) {
7+ this . chart . resize ( )
8+ }
9+ } , 100 )
10+ window . addEventListener ( 'resize' , this . __resizeHanlder )
11+ } ,
12+ beforeDestroy ( ) {
13+ window . removeEventListener ( 'resize' , this . __resizeHanlder )
14+ }
15+ }
You can’t perform that action at this time.
0 commit comments