mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +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) {
|
if (slots.icon) {
|
||||||
return (
|
return (
|
||||||
<Badge dot={dot} content={badge} class={bem('icon')}>
|
<Badge
|
||||||
{slots.icon()}
|
v-slots={{ default: slots.icon }}
|
||||||
</Badge>
|
dot={dot}
|
||||||
|
content={badge}
|
||||||
|
class={bem('icon')}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,6 +558,7 @@ export default defineComponent({
|
|||||||
if (props.poppable) {
|
if (props.poppable) {
|
||||||
return (
|
return (
|
||||||
<Popup
|
<Popup
|
||||||
|
v-slots={{ default: renderCalendar }}
|
||||||
show={props.show}
|
show={props.show}
|
||||||
class={bem('popup')}
|
class={bem('popup')}
|
||||||
round={props.round}
|
round={props.round}
|
||||||
@ -567,9 +568,7 @@ export default defineComponent({
|
|||||||
closeOnPopstate={props.closeOnPopstate}
|
closeOnPopstate={props.closeOnPopstate}
|
||||||
closeOnClickOverlay={props.closeOnClickOverlay}
|
closeOnClickOverlay={props.closeOnClickOverlay}
|
||||||
onUpdate:show={updateShow}
|
onUpdate:show={updateShow}
|
||||||
>
|
/>
|
||||||
{renderCalendar()}
|
|
||||||
</Popup>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,9 +80,11 @@ export default defineComponent({
|
|||||||
const renderIcon = () => {
|
const renderIcon = () => {
|
||||||
if (slots.icon) {
|
if (slots.icon) {
|
||||||
return (
|
return (
|
||||||
<Badge dot={props.dot} content={props.badge}>
|
<Badge
|
||||||
{slots.icon()}
|
v-slots={{ default: slots.icon }}
|
||||||
</Badge>
|
dot={props.dot}
|
||||||
|
content={props.badge}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,9 +56,7 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<Transition name="van-fade" appear>
|
<Transition v-slots={{ default: renderOverlay }} name="van-fade" appear />
|
||||||
{renderOverlay()}
|
|
||||||
</Transition>
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -201,13 +201,12 @@ export default defineComponent({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Transition
|
<Transition
|
||||||
|
v-slots={{ default: renderPopup }}
|
||||||
name={transition || name}
|
name={transition || name}
|
||||||
appear={transitionAppear}
|
appear={transitionAppear}
|
||||||
onAfterEnter={onOpened}
|
onAfterEnter={onOpened}
|
||||||
onAfterLeave={onClosed}
|
onAfterLeave={onClosed}
|
||||||
>
|
/>
|
||||||
{renderPopup()}
|
|
||||||
</Transition>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -123,7 +123,12 @@ export default defineComponent({
|
|||||||
nodes.push(<div class={bem('text')}>{getStatusText()}</div>);
|
nodes.push(<div class={bem('text')}>{getStatusText()}</div>);
|
||||||
}
|
}
|
||||||
if (status === 'loading') {
|
if (status === 'loading') {
|
||||||
nodes.push(<Loading class={bem('loading')}>{getStatusText()}</Loading>);
|
nodes.push(
|
||||||
|
<Loading
|
||||||
|
v-slots={{ default: getStatusText }}
|
||||||
|
class={bem('loading')}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodes;
|
return nodes;
|
||||||
|
@ -83,9 +83,12 @@ export default defineComponent({
|
|||||||
style={{ color }}
|
style={{ color }}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
<Badge dot={dot} content={badge} class={bem('icon')}>
|
<Badge
|
||||||
{renderIcon()}
|
v-slots={{ default: renderIcon }}
|
||||||
</Badge>
|
dot={dot}
|
||||||
|
content={badge}
|
||||||
|
class={bem('icon')}
|
||||||
|
/>
|
||||||
<div class={bem('text')}>
|
<div class={bem('text')}>
|
||||||
{slots.default?.({ active: active.value })}
|
{slots.default?.({ active: active.value })}
|
||||||
</div>
|
</div>
|
||||||
|
@ -95,6 +95,7 @@ export default defineComponent({
|
|||||||
if (isImageFile(item)) {
|
if (isImageFile(item)) {
|
||||||
return (
|
return (
|
||||||
<Image
|
<Image
|
||||||
|
v-slots={{ default: renderCover }}
|
||||||
fit={props.imageFit}
|
fit={props.imageFit}
|
||||||
src={item.content || item.url}
|
src={item.content || item.url}
|
||||||
class={bem('preview-image')}
|
class={bem('preview-image')}
|
||||||
@ -102,9 +103,7 @@ export default defineComponent({
|
|||||||
height={props.previewSize}
|
height={props.previewSize}
|
||||||
lazyLoad={props.lazyLoad}
|
lazyLoad={props.lazyLoad}
|
||||||
onClick={onPreview}
|
onClick={onPreview}
|
||||||
>
|
/>
|
||||||
{renderCover()}
|
|
||||||
</Image>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user