style: slots.default?.()

pull/3053/head
Amour1688 2020-10-24 20:36:57 +08:00
parent 6891c38705
commit d219ff1655
16 changed files with 16 additions and 18 deletions

View File

@ -68,7 +68,7 @@ const TransButton = defineComponent({
onKeyup={this.onKeyUp}
style={{ ...(!noStyle ? inlineStyle : null) }}
>
{this.$slots.default && this.$slots.default()}
{this.$slots.default?.()}
</div>
);
},

View File

@ -169,6 +169,6 @@ export default defineComponent({
if (csp) {
this.csp = csp;
}
return this.$slots.default && this.$slots.default()[0];
return this.$slots.default?.()[0];
},
});

View File

@ -258,7 +258,7 @@ const Affix = defineComponent({
>
<div {...props} style={placeholderStyle} ref="placeholderNode">
<div class={className} ref="fixedNode" style={affixStyle}>
{$slots.default && $slots.default()}
{$slots.default?.()}
</div>
</div>
</ResizeObserver>

View File

@ -283,7 +283,7 @@ export default defineComponent({
<div class={`${prefixCls}-ink`}>
<span class={inkClass} ref="inkNode" />
</div>
{$slots.default && $slots.default()}
{$slots.default?.()}
</div>
</div>
);

View File

@ -82,7 +82,7 @@ export default defineComponent({
>
{title}
</a>
{$slots.default && $slots.default()}
{$slots.default?.()}
</div>
);
},

View File

@ -118,7 +118,7 @@ export default defineComponent({
}
: {};
let children: VueNode = this.$slots.default && this.$slots.default();
let children: VueNode = this.$slots.default?.();
if (src && isImgExist) {
children = (
<img src={src} srcset={srcset || srcSet} onError={this.handleImgLoadError} alt={alt} />

View File

@ -93,7 +93,7 @@ const BackTop = defineComponent({
};
const backTopBtn = this.visible ? (
<div {...divProps}>{($slots.default && $slots.default()) || defaultElement}</div>
<div {...divProps}>{$slots.default?.() || defaultElement}</div>
) : null;
const transitionProps = getTransitionProps('fade');
return <Transition {...transitionProps}>{backTopBtn}</Transition>;

View File

@ -187,7 +187,7 @@ const Drawer = defineComponent({
>
{this.renderHeader(prefixCls)}
<div key="body" class={`${prefixCls}-body`} style={bodyStyle}>
{this.$slots.default && this.$slots.default()}
{this.$slots.default?.()}
</div>
</div>
);

View File

@ -216,7 +216,7 @@ const Select = defineComponent({
dropdownClassName={rcSelectRtlDropDownClassName}
onChange={triggerChange}
>
{slots.default && slots.default()}
{slots.default?.()}
</RcSelect>
);
},

View File

@ -43,7 +43,7 @@ export default defineComponent({
[`${prefixCls}-reverse`]: !!reverse,
[`${prefixCls}-${mode}`]: !!mode,
});
const children = filterEmpty(this.$slots.default && this.$slots.default());
const children = filterEmpty(this.$slots.default?.());
// // Remove falsy items
// const falsylessItems = filterEmpty(this.$slots.default)
// const items = falsylessItems.map((item, idx) => {

View File

@ -52,9 +52,7 @@ export default defineComponent({
>
{dot}
</div>
<div class={`${prefixCls}-item-content`}>
{this.$slots.default && this.$slots.default()}
</div>
<div class={`${prefixCls}-item-content`}>{this.$slots.default?.()}</div>
</li>
);
},

View File

@ -10,7 +10,7 @@ const FunctionProvider = {
if (props.injectExtraPropsKey) {
provide(props.injectExtraPropsKey, reactive(attrs));
}
return () => slots.default && slots.default();
return () => slots.default?.();
},
};

View File

@ -83,7 +83,7 @@ const VueResizeObserver = defineComponent({
},
render() {
return this.$slots.default && this.$slots.default()[0];
return this.$slots.default?.()[0];
},
});

View File

@ -40,7 +40,7 @@ const TransBtn = (props: TransBtnProps, { slots }: SetupContext) => {
icon
) : (
<span class={className.split(/\s+/).map((cls: any) => `${cls}-icon`)}>
{slots.default && slots.default()}
{slots.default?.()}
</span>
)}
</span>

View File

@ -246,7 +246,7 @@ export default {
align={align}
onAlign={this.onAlign}
>
<PopupInner {...popupInnerProps}>{$slots.default && $slots.default()}</PopupInner>
<PopupInner {...popupInnerProps}>{$slots.default?.()}</PopupInner>
</Align>
) : null}
</Transition>

View File

@ -13,7 +13,7 @@ export default {
return (
<div class={!visible ? hiddenClassName : ''}>
<LazyRenderBox class={`${prefixCls}-content`} visible={visible}>
{this.$slots.default && this.$slots.default()}
{this.$slots.default?.()}
</LazyRenderBox>
</div>
);