fix spin
							parent
							
								
									bd41173688
								
							
						
					
					
						commit
						832d13eb0c
					
				|  | @ -2,7 +2,8 @@ | ||||||
| import PropTypes from '../_util/vue-types' | import PropTypes from '../_util/vue-types' | ||||||
| import BaseMixin from '../_util/BaseMixin' | import BaseMixin from '../_util/BaseMixin' | ||||||
| import isCssAnimationSupported from '../_util/isCssAnimationSupported' | import isCssAnimationSupported from '../_util/isCssAnimationSupported' | ||||||
| import animate from '../_util/css-animation' | import { filterEmpty } from '../_util/vnode' | ||||||
|  | import getTransitionProps from '../_util/getTransitionProps' | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|   name: 'Spin', |   name: 'Spin', | ||||||
|  | @ -25,8 +26,11 @@ export default { | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|     getHasDefaultSlots () { |     getChildren () { | ||||||
|       return this.$slots && this.$slots.default |       if (this.$slots && this.$slots.default) { | ||||||
|  |         return filterEmpty(this.$slots.default) | ||||||
|  |       } | ||||||
|  |       return null | ||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
|   mounted () { |   mounted () { | ||||||
|  | @ -96,8 +100,8 @@ export default { | ||||||
|         {tip ? <div class={`${prefixCls}-text`}>{tip}</div> : null} |         {tip ? <div class={`${prefixCls}-text`}>{tip}</div> : null} | ||||||
|       </div> |       </div> | ||||||
|     ) |     ) | ||||||
| 
 |     const children = this.getChildren() | ||||||
|     if (this.getHasDefaultSlots()) { |     if (children) { | ||||||
|       let animateClassName = prefixCls + '-nested-loading' |       let animateClassName = prefixCls + '-nested-loading' | ||||||
|       if (wrapperClassName) { |       if (wrapperClassName) { | ||||||
|         animateClassName += ' ' + wrapperClassName |         animateClassName += ' ' + wrapperClassName | ||||||
|  | @ -107,33 +111,17 @@ export default { | ||||||
|         [`${prefixCls}-blur`]: stateSpinning, |         [`${prefixCls}-blur`]: stateSpinning, | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       const transitionProps = { |       return ( | ||||||
|         props: Object.assign({ |         <transition-group | ||||||
|           appear: true, |           {...getTransitionProps('fade')} | ||||||
|           css: false, |           tag='div' | ||||||
|         }), |           class={animateClassName} | ||||||
|       } |         > | ||||||
|       const transitionEvent = { |  | ||||||
|         enter: (el, done) => { |  | ||||||
|           animate(el, 'fade-enter', done) |  | ||||||
|         }, |  | ||||||
|         leave: (el, done) => { |  | ||||||
|           animate(el, 'fade-leave', done) |  | ||||||
|         }, |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|       transitionProps.on = transitionEvent |  | ||||||
| 
 |  | ||||||
|       return (<transition |  | ||||||
|         {...transitionProps} |  | ||||||
|       > |  | ||||||
|         <div class={animateClassName}> |  | ||||||
|           {stateSpinning && <div key='loading'>{spinElement}</div>} |           {stateSpinning && <div key='loading'>{spinElement}</div>} | ||||||
|           <div class={containerClassName} key='container'> |           <div class={containerClassName} key='container'> | ||||||
|             {this.$slots.default} |             {children} | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </transition-group> | ||||||
|       </transition> |  | ||||||
|       ) |       ) | ||||||
|     } |     } | ||||||
|     return spinElement |     return spinElement | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 tangjinzhou
						tangjinzhou