<template>
  <!-- 移动端上拉加载更多 -->
</template>
<script>
  export default {
    props: ['searchMore', 'allPage', 'page'],
    mounted () {
      let _this = this
      _this.$nextTick(function () {
        window.addEventListener('scroll', function () {
          _this.scroll()
        }, false)
      })
    },
    methods: {
      scroll: function () {
        let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
        if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.searchMore && this.page < this.allPage) {
          this.getMore()
        }
      },
      getMore: function () {
        if (!this.searchMore) {
          this.$emit('pullUpAction')
        }
      }
    }
  }
</script>
<style lang="scss" scoped>
  .loading {
    text-align: center;
    background: #fff;
    >img {
      width: .64rem;
      height: .64rem;
      margin: .2rem 0;
    }
  }
</style>
