mirror of
				https://gitee.com/vant-contrib/vant.git
				synced 2025-10-31 03:22:08 +08:00 
			
		
		
		
	chore: improve compiled jsx code of default slot (#9676)
* chore: improve compiled jsx code of default slot * fix: teleport not support v-slots
This commit is contained in:
		
							parent
							
								
									7eb9344446
								
							
						
					
					
						commit
						6799189f57
					
				| @ -35,9 +35,12 @@ export default defineComponent({ | ||||
| 
 | ||||
|       if (slots.icon) { | ||||
|         return ( | ||||
|           <Badge dot={dot} content={badge} class={bem('icon')}> | ||||
|             {slots.icon()} | ||||
|           </Badge> | ||||
|           <Badge | ||||
|             v-slots={{ default: slots.icon }} | ||||
|             dot={dot} | ||||
|             content={badge} | ||||
|             class={bem('icon')} | ||||
|           /> | ||||
|         ); | ||||
|       } | ||||
| 
 | ||||
|  | ||||
| @ -558,6 +558,7 @@ export default defineComponent({ | ||||
|       if (props.poppable) { | ||||
|         return ( | ||||
|           <Popup | ||||
|             v-slots={{ default: renderCalendar }} | ||||
|             show={props.show} | ||||
|             class={bem('popup')} | ||||
|             round={props.round} | ||||
| @ -567,9 +568,7 @@ export default defineComponent({ | ||||
|             closeOnPopstate={props.closeOnPopstate} | ||||
|             closeOnClickOverlay={props.closeOnClickOverlay} | ||||
|             onUpdate:show={updateShow} | ||||
|           > | ||||
|             {renderCalendar()} | ||||
|           </Popup> | ||||
|           /> | ||||
|         ); | ||||
|       } | ||||
| 
 | ||||
|  | ||||
| @ -80,9 +80,11 @@ export default defineComponent({ | ||||
|     const renderIcon = () => { | ||||
|       if (slots.icon) { | ||||
|         return ( | ||||
|           <Badge dot={props.dot} content={props.badge}> | ||||
|             {slots.icon()} | ||||
|           </Badge> | ||||
|           <Badge | ||||
|             v-slots={{ default: slots.icon }} | ||||
|             dot={props.dot} | ||||
|             content={props.badge} | ||||
|           /> | ||||
|         ); | ||||
|       } | ||||
| 
 | ||||
|  | ||||
| @ -56,9 +56,7 @@ export default defineComponent({ | ||||
|     }); | ||||
| 
 | ||||
|     return () => ( | ||||
|       <Transition name="van-fade" appear> | ||||
|         {renderOverlay()} | ||||
|       </Transition> | ||||
|       <Transition v-slots={{ default: renderOverlay }} name="van-fade" appear /> | ||||
|     ); | ||||
|   }, | ||||
| }); | ||||
|  | ||||
| @ -201,13 +201,12 @@ export default defineComponent({ | ||||
| 
 | ||||
|       return ( | ||||
|         <Transition | ||||
|           v-slots={{ default: renderPopup }} | ||||
|           name={transition || name} | ||||
|           appear={transitionAppear} | ||||
|           onAfterEnter={onOpened} | ||||
|           onAfterLeave={onClosed} | ||||
|         > | ||||
|           {renderPopup()} | ||||
|         </Transition> | ||||
|         /> | ||||
|       ); | ||||
|     }; | ||||
| 
 | ||||
|  | ||||
| @ -123,7 +123,12 @@ export default defineComponent({ | ||||
|         nodes.push(<div class={bem('text')}>{getStatusText()}</div>); | ||||
|       } | ||||
|       if (status === 'loading') { | ||||
|         nodes.push(<Loading class={bem('loading')}>{getStatusText()}</Loading>); | ||||
|         nodes.push( | ||||
|           <Loading | ||||
|             v-slots={{ default: getStatusText }} | ||||
|             class={bem('loading')} | ||||
|           /> | ||||
|         ); | ||||
|       } | ||||
| 
 | ||||
|       return nodes; | ||||
|  | ||||
| @ -83,9 +83,12 @@ export default defineComponent({ | ||||
|           style={{ color }} | ||||
|           onClick={onClick} | ||||
|         > | ||||
|           <Badge dot={dot} content={badge} class={bem('icon')}> | ||||
|             {renderIcon()} | ||||
|           </Badge> | ||||
|           <Badge | ||||
|             v-slots={{ default: renderIcon }} | ||||
|             dot={dot} | ||||
|             content={badge} | ||||
|             class={bem('icon')} | ||||
|           /> | ||||
|           <div class={bem('text')}> | ||||
|             {slots.default?.({ active: active.value })} | ||||
|           </div> | ||||
|  | ||||
| @ -95,6 +95,7 @@ export default defineComponent({ | ||||
|       if (isImageFile(item)) { | ||||
|         return ( | ||||
|           <Image | ||||
|             v-slots={{ default: renderCover }} | ||||
|             fit={props.imageFit} | ||||
|             src={item.content || item.url} | ||||
|             class={bem('preview-image')} | ||||
| @ -102,9 +103,7 @@ export default defineComponent({ | ||||
|             height={props.previewSize} | ||||
|             lazyLoad={props.lazyLoad} | ||||
|             onClick={onPreview} | ||||
|           > | ||||
|             {renderCover()} | ||||
|           </Image> | ||||
|           /> | ||||
|         ); | ||||
|       } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user