Skip to content

fix(FloatButton): BackTop attribute invalid #7009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 16, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions components/float-button/BackTop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,31 +110,29 @@ const BackTop = defineComponent({
});
const floatButtonGroupContext = useInjectFloatButtonGroupContext();
return () => {
const defaultElement = (
<div class={`${prefixCls.value}-content`}>
<div class={`${prefixCls.value}-icon`}>
<VerticalAlignTopOutlined />
</div>
</div>
);
const { description, type, shape, tooltip, badge } = props;

const floatButtonProps = {
...attrs,
shape: floatButtonGroupContext?.shape.value || props.shape,
shape: floatButtonGroupContext?.shape.value || shape,
onClick: scrollToTop,
class: {
[`${prefixCls.value}`]: true,
[`${attrs.class}`]: attrs.class,
[`${prefixCls.value}-rtl`]: direction.value === 'rtl',
},
description,
type,
tooltip,
badge,
};

const transitionProps = getTransitionProps('fade');
return wrapSSR(
<Transition {...transitionProps}>
<FloatButton v-show={state.visible} {...floatButtonProps} ref={domRef}>
{{
icon: () => <VerticalAlignTopOutlined />,
default: () => slots.default?.() || defaultElement,
icon: () => slots.default?.() || slots.icon?.() || <VerticalAlignTopOutlined />,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我发现 default 是没有用到的吧, 就去掉吧,留着以后万一要加点什么

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1

}}
</FloatButton>
</Transition>,
Expand Down