# Backtop 回到顶部

返回页面顶部的操作按钮

# 基础用法

滑动页面即可看到右下方的按钮。

Scroll down to see the bottom-right button.
<template>
  <div>
    Scroll down to see the bottom-right button.
    <el-backtop target=".page"></el-backtop>
 </div>
</template>
1
2
3
4
5
6
显示代码 复制代码

# 自定义显示内容

显示区域被固定为 40px * 40px 的区域, 其中的内容可支持自定义。

Scroll down to see the bottom-right button.
<template>
  <div>
    Scroll down to see the bottom-right button.
    <el-backtop target=".page" :bottom="100">
      <div
        style="{
          height: 100%;
          width: 100%;
          background-color: #f2f5f6;
          box-shadow: 0 0 6px rgba(0,0,0, .12);
          text-align: center;
          line-height: 40px;
          color: #1989fa;
        }"
      >
        UP
      </div>
    </el-backtop>
  </div>
</template>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
显示代码 复制代码

# Attributes

参数 说明 类型 可选值 默认值
target 触发滚动的对象 string
visibility-height 滚动高度达到此参数值才出现 number 200
right 控制其显示位置, 距离页面右边距 number 40
bottom 控制其显示位置, 距离页面底部距离 number 40

# Events

事件名 说明 回调参数
click 点击按钮触发的事件 点击事件
Last Updated: 7/24/2021, 4:16:04 PM