fix(FloatButton): BackTop attribute invalid (#7009)

* fix(FloatButton): BackTop attribute invalid

* fix: attribute props

* fix: Remove default slot

---------

Co-authored-by: undefined <undefined>
pull/7025/head
selicens 1 year ago committed by GitHub
parent 398710cf1b
commit f1bcf2093a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -110,22 +110,21 @@ const BackTop = defineComponent({
}); });
const floatButtonGroupContext = useInjectFloatButtonGroupContext(); const floatButtonGroupContext = useInjectFloatButtonGroupContext();
return () => { return () => {
const defaultElement = ( const { description, type, shape, tooltip, badge } = props;
<div class={`${prefixCls.value}-content`}>
<div class={`${prefixCls.value}-icon`}>
<VerticalAlignTopOutlined />
</div>
</div>
);
const floatButtonProps = { const floatButtonProps = {
...attrs, ...attrs,
shape: floatButtonGroupContext?.shape.value || props.shape, shape: floatButtonGroupContext?.shape.value || shape,
onClick: scrollToTop, onClick: scrollToTop,
class: { class: {
[`${prefixCls.value}`]: true, [`${prefixCls.value}`]: true,
[`${attrs.class}`]: attrs.class, [`${attrs.class}`]: attrs.class,
[`${prefixCls.value}-rtl`]: direction.value === 'rtl', [`${prefixCls.value}-rtl`]: direction.value === 'rtl',
}, },
description,
type,
tooltip,
badge,
}; };
const transitionProps = getTransitionProps('fade'); const transitionProps = getTransitionProps('fade');
@ -133,8 +132,7 @@ const BackTop = defineComponent({
<Transition {...transitionProps}> <Transition {...transitionProps}>
<FloatButton v-show={state.visible} {...floatButtonProps} ref={domRef}> <FloatButton v-show={state.visible} {...floatButtonProps} ref={domRef}>
{{ {{
icon: () => <VerticalAlignTopOutlined />, icon: () => slots.icon?.() || <VerticalAlignTopOutlined />,
default: () => slots.default?.() || defaultElement,
}} }}
</FloatButton> </FloatButton>
</Transition>, </Transition>,

Loading…
Cancel
Save