跳转到主内容
导航类 · BackTop
回到顶部

Vue 使用说明:从 @aifuxi/semi-ui-vue/back-top 子路径引入组件,浏览器构建会自动按需加载默认主题。本页 Vue API 与示例以当前公开实现为准。

代码演示 ​

如何引入 ​

查看代码 · js
import { BackTop } from '@aifuxi/semi-ui-vue';

基本用法 ​

BackTop 预设了基本的返回按钮,可以直接调用。

Scroll down to see the bottom-right gray button.

自定义样式 ​

BackTop 预设了默认样式,包括:距离底部 50px,距离右侧 100px,box-sizing 为 border-box,内容水平居中。样式可以覆盖。

Scroll down to see the bottom-right blue circular button.

API 参考 ​

Vue 契约 ​

以下内容以 packages/ui/src/back-top/types.ts 的公开类型为准。

Vue 事件 ​

BackTop

事件参数说明
click[event: MouseEvent]点击回到顶部按钮时触发

Vue 插槽 ​

BackTop

插槽作用域参数说明
default{}自定义回到顶部按钮
属性说明类型默认值
className类名string-
duration滚动到顶部的时间number450
style样式名CSSProperties-
target返回值为需要监听其滚动事件的元素对应 DOM 元素的函数() => BackTopTarget | null | undefined() => window
visibilityHeight出现 BackTop 需要达到的滚动高度number400