File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change 11<template >
2- <div class =" md-list-expand" :style =" { 'margin-bottom': height } " :class =" classes" ref =" expand" >
2+ <div class =" md-list-expand" :style =" styles " :class =" classes" ref =" expand" >
33 <slot ></slot >
44 </div >
55</template >
1818 return {
1919 ' md-transition-off' : this .transitionOff
2020 };
21+ },
22+ styles () {
23+ return {
24+ ' margin-bottom' : this .height
25+ };
2126 }
2227 },
2328 methods: {
2429 calculatePadding () {
25- this .height = - this .$el .offsetHeight + ' px' ;
30+ window .requestAnimationFrame (() => {
31+ this .height = - this .$el .offsetHeight - 48 + ' px' ;
2632
27- window .setTimeout (() => {
28- this .transitionOff = false ;
33+ window .setTimeout (() => {
34+ this .transitionOff = false ;
35+ });
2936 });
3037 },
31- recalculateAfterChildChange () {
38+ recalculateAfterChange () {
3239 this .transitionOff = true ;
3340 this .calculatePadding ();
3441 },
3542 observeChildChanges () {
36- this .contentObserver = new MutationObserver (this .recalculateAfterChildChange );
43+ this .contentObserver = new MutationObserver (this .recalculateAfterChange );
3744 this .contentObserver .observe (this .$refs .expand , {
3845 childList: true ,
3946 characterData: true ,
4451 mounted () {
4552 this .calculatePadding ();
4653 this .observeChildChanges ();
54+ window .addEventListener (' resize' , this .recalculateAfterChange );
4755 },
4856 beforeDestroy () {
4957 if (this .contentObserver ) {
5058 this .contentObserver .disconnect ();
5159 }
60+
61+ window .removeEventListener (' resize' , this .recalculateAfterChange );
5262 }
5363 };
5464 </script >
You can’t perform that action at this time.
0 commit comments