<template>
  <transition name="back-top-fade">
    <div class="el-back-top" style=""
      v-show="showBackToTop"
      @click="toTop">
      <i class="uk-icon-back-top"></i>
    </div>
  </transition>
</template>

<script>

export default {
  name: 'ElBackTop',
  componentName: 'ElBackTop',
  data() {
    return {
    }
  },
  props: {
    scrollTop: {
      type: Number,
      defualt: 0 
    },
    topMethod: Function
  },
  computed: {
    showBackToTop() {
      return this.scrollTop >= 0.5 * document.body.clientHeight;
    }
  },
  components: {

  },
  methods: {
    toTop() {
      this.topMethod && this.topMethod();
    }
  },
  mounted() {

  }
}

</script>