antd里back-top 返回顶部的使用

503 阅读1分钟

使用

参考文档:www.antdv.com/components/…

注意:

target绑定要获取的元素

1.一定要有高度 2.和y轴的滚动条自动

<a-back-top
  :target="fn"
  :visibilityHeight="100"
/>

methods: {
fn() {
  return document.querySelector('.admin-layout-main')
}}
// 给设定的元素给高度
.admin-layout-main {
    height: 100vh;
    overflow-y: auto;
    }

代码图解

image.png

image.png