fix: space remounted slot, close #6500
							parent
							
								
									6d1035f1b0
								
							
						
					
					
						commit
						80fbabc66f
					
				|  | @ -1,5 +1,5 @@ | |||
| import type { PropType, ExtractPropTypes, CSSProperties } from 'vue'; | ||||
| import { defineComponent, computed, ref, watch } from 'vue'; | ||||
| import { defineComponent, computed, ref, watch, Fragment } from 'vue'; | ||||
| import PropTypes from '../_util/vue-types'; | ||||
| import { filterEmpty } from '../_util/props-util'; | ||||
| import type { SizeType } from '../config-provider'; | ||||
|  | @ -80,8 +80,8 @@ const Space = defineComponent({ | |||
|     }); | ||||
|     return () => { | ||||
|       const { wrap, direction = 'horizontal' } = props; | ||||
| 
 | ||||
|       const items = filterEmpty(slots.default?.()); | ||||
|       const children = slots.default?.(); | ||||
|       const items = filterEmpty(children); | ||||
|       const len = items.length; | ||||
| 
 | ||||
|       if (len === 0) { | ||||
|  | @ -94,6 +94,7 @@ const Space = defineComponent({ | |||
|       return ( | ||||
|         <div class={cn.value} style={style.value}> | ||||
|           {items.map((child, index) => { | ||||
|             const originIndex = children.indexOf(child); | ||||
|             let itemStyle: CSSProperties = {}; | ||||
|             if (!supportFlexGap.value) { | ||||
|               if (direction === 'vertical') { | ||||
|  | @ -111,7 +112,7 @@ const Space = defineComponent({ | |||
|             } | ||||
| 
 | ||||
|             return ( | ||||
|               <> | ||||
|               <Fragment key={originIndex}> | ||||
|                 <div class={itemClassName} style={itemStyle}> | ||||
|                   {child} | ||||
|                 </div> | ||||
|  | @ -120,7 +121,7 @@ const Space = defineComponent({ | |||
|                     {split} | ||||
|                   </span> | ||||
|                 )} | ||||
|               </> | ||||
|               </Fragment> | ||||
|             ); | ||||
|           })} | ||||
|         </div> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 tangjinzhou
						tangjinzhou