diff --git a/components/_util/transButton.jsx b/components/_util/transButton.jsx index 754d8f0f8..cfece1a0d 100644 --- a/components/_util/transButton.jsx +++ b/components/_util/transButton.jsx @@ -68,7 +68,7 @@ const TransButton = defineComponent({ onKeyup={this.onKeyUp} style={{ ...(!noStyle ? inlineStyle : null) }} > - {this.$slots.default && this.$slots.default()} + {this.$slots.default?.()} ); }, diff --git a/components/_util/wave.jsx b/components/_util/wave.jsx index 6f41a4a08..945ca7cc9 100644 --- a/components/_util/wave.jsx +++ b/components/_util/wave.jsx @@ -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]; }, }); diff --git a/components/affix/index.tsx b/components/affix/index.tsx index 29e1bb06f..2d32dbaee 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -258,7 +258,7 @@ const Affix = defineComponent({ >
- {$slots.default && $slots.default()} + {$slots.default?.()}
diff --git a/components/anchor/Anchor.tsx b/components/anchor/Anchor.tsx index f761ae214..a76522d4f 100644 --- a/components/anchor/Anchor.tsx +++ b/components/anchor/Anchor.tsx @@ -283,7 +283,7 @@ export default defineComponent({
- {$slots.default && $slots.default()} + {$slots.default?.()} ); diff --git a/components/anchor/AnchorLink.tsx b/components/anchor/AnchorLink.tsx index 73703c266..4a2578bfe 100644 --- a/components/anchor/AnchorLink.tsx +++ b/components/anchor/AnchorLink.tsx @@ -82,7 +82,7 @@ export default defineComponent({ > {title} - {$slots.default && $slots.default()} + {$slots.default?.()} ); }, diff --git a/components/avatar/Avatar.tsx b/components/avatar/Avatar.tsx index c57d6b94f..9eeabd45d 100644 --- a/components/avatar/Avatar.tsx +++ b/components/avatar/Avatar.tsx @@ -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 = ( {alt} diff --git a/components/back-top/index.tsx b/components/back-top/index.tsx index c96d9c816..01596aef1 100644 --- a/components/back-top/index.tsx +++ b/components/back-top/index.tsx @@ -93,7 +93,7 @@ const BackTop = defineComponent({ }; const backTopBtn = this.visible ? ( -
{($slots.default && $slots.default()) || defaultElement}
+
{$slots.default?.() || defaultElement}
) : null; const transitionProps = getTransitionProps('fade'); return {backTopBtn}; diff --git a/components/cascader/__tests__/__snapshots__/index.test.js.snap b/components/cascader/__tests__/__snapshots__/index.test.js.snap index 4a1805f5e..9c16dbf92 100644 --- a/components/cascader/__tests__/__snapshots__/index.test.js.snap +++ b/components/cascader/__tests__/__snapshots__/index.test.js.snap @@ -69,7 +69,7 @@ exports[`Cascader can be selected 3`] = ` exports[`Cascader popup correctly when panel is open 1`] = `
-
+