Elements

组件

回到顶部 Back Top

BackTop:回到顶部按钮。页面滚动超过 `threshold` 后,小型浮动按钮出现在页面角落,并把使用者带回顶部。滚动保持原生行为——`window.scrollTo` 遵循样式表的 `scroll-behavior: smooth`;reduced motion 会改回即时跳转(自带滚动容器的控件没有样式表可遵循,因此直接查询 media query)。两种情况下按钮都保持挂载,进场走过渡而不是突然出现。控件复用共享 `Button`(outline、方形);纸面、发丝线和聚焦光晕由它提供,这个家族只负责浮动和进场。

#基础用法

back-top/basic Vue React

Passage 1 — the box travels far enough for the way home to earn its keep. Keep scrolling and the little tile rises at the corner of the paper.

Passage 2 — the box travels far enough for the way home to earn its keep. Keep scrolling and the little tile rises at the corner of the paper.

Passage 3 — the box travels far enough for the way home to earn its keep. Keep scrolling and the little tile rises at the corner of the paper.

Passage 4 — the box travels far enough for the way home to earn its keep. Keep scrolling and the little tile rises at the corner of the paper.

Passage 5 — the box travels far enough for the way home to earn its keep. Keep scrolling and the little tile rises at the corner of the paper.

Passage 6 — the box travels far enough for the way home to earn its keep. Keep scrolling and the little tile rises at the corner of the paper.

Passage 7 — the box travels far enough for the way home to earn its keep. Keep scrolling and the little tile rises at the corner of the paper.

Passage 8 — the box travels far enough for the way home to earn its keep. Keep scrolling and the little tile rises at the corner of the paper.

Passage 9 — the box travels far enough for the way home to earn its keep. Keep scrolling and the little tile rises at the corner of the paper.

Passage 10 — the box travels far enough for the way home to earn its keep. Keep scrolling and the little tile rises at the corner of the paper.

Passage 11 — the box travels far enough for the way home to earn its keep. Keep scrolling and the little tile rises at the corner of the paper.

Passage 12 — the box travels far enough for the way home to earn its keep. Keep scrolling and the little tile rises at the corner of the paper.

back-top/custom-threshold Vue React

Passage 1 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 2 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 3 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 4 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 5 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 6 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 7 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 8 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 9 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 10 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 11 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 12 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 13 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 14 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 15 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

Passage 16 — a larger threshold: the tile waits until the reader is properly lost before offering the way home.

#属性

#BackTop

BackTop:回到顶部按钮。页面滚动超过 threshold 后,小型浮动按钮出现在页面角落,并把使用者带回顶部。滚动保持原生行为——window.scrollTo 遵循样式表的 scroll-behavior: smooth;reduced motion 会改回即时跳转(自带滚动容器的控件没有样式表可遵循,因此直接查询 media query)。两种情况下按钮都保持挂载,进场走过渡而不是突然出现。控件复用共享 Button(outline、方形);纸面、发丝线和聚焦光晕由它提供,这个家族只负责浮动和进场。

属性类型默认值描述
thresholdNumber400—
labelString"Back to top"—
scrollElFunctionundefined—