<template>
  <div class="demo-back-top-custom-target">
    <div
      ref="content"
      class="demo-back-top-custom-target-content">
      向下滚动后，见右下角绿色按钮<br />

      向下滚动后，见右下角绿色按钮<br />

      向下滚动后，见右下角绿色按钮<br />

      向下滚动后，见右下角绿色按钮<br />

      向下滚动后，见右下角绿色按钮<br />
    </div>
    <ui-back-top
      :visibility-height="0"
      :target="getTarget"
      :style="{
        position: 'absolute',
      }">
      <div class="demo-back-top-custom-target-inner">
        UP
      </div>
    </ui-back-top>
  </div>
</template>

<script>
import { BackTop } from "amumu-ui"
export default {
  components: {
    "ui-back-top": BackTop,
  },
  methods: {
    getTarget() {
      return this.$refs.content
    },
  },
}
</script>

<style lang="scss">
.demo-back-top-custom-target {
  position: relative;
  &-content {
    max-height: 400px;
    line-height: 100px;
    overflow-y: scroll;
  }
  &-inner {
    height: 40px;
    width: 40px;
    line-height: 40px;
    border-radius: 4px;
    color: rgb(255, 255, 255);
    text-align: center;
    font-size: 20px;
    background-color: rgb(10, 220, 80);
  }
}
</style>
