<template>
  <div>
    <divider>Pull Up to Refresh: default</divider>
    <scroller
      lock-x
      scrollbar-y
      use-pullup
      height="200px"
      @on-pullup-loading="load1"
    >
      <div class="box2">
        <p
          v-for="i in n1"
          :key="i"
        >
          placeholder {{ i }}
        </p>
      </div>
    </scroller>
    <divider>Chinese: 上拉刷新</divider>
    <scroller
      lock-x
      scrollbar-y
      use-pullup
      :pullup-config="pullupConfig2"
      height="200px"
      @on-pullup-loading="load2"
    >
      <div class="box2">
        <p
          v-for="i in n2"
          :key="i"
        >
          占位 {{ i }}
        </p>
      </div>
    </scroller>
    <!--     <divider>custom pullup html template</divider>
    <scroller lock-x scrollbar-y use-pullup height="200px" v-model="status2" @on-pullup-loading="load3">
      <div class="box2">
        <p v-for="i in n3">placeholder {{i}}</p>
      </div>
      <div slot="pullup" class="xs-plugin-pullup-container xs-plugin-pullup-up" style="position: absolute; width: 100%; height: 40px; bottom: -40px; text-align: center;">
        <span v-show="status2.pulldownStatus === 'default'"></span>
        <span class="pulldown-arrow" v-show="status2.pulldownStatus === 'down' || status2.pulldownStatus === 'up'" :class="{'rotate': status2.pulldownStatus === 'up'}">↓</span>
        <span v-show="status2.pulldownStatus === 'loading'"><spinner type="ios-small"></spinner></span>
      </div>
    </scroller> -->
  </div>
</template>
<script>
import { Scroller, Divider } from '../components/_index'

export default {
  components: {
    Scroller,
    Divider
  },
  data() {
    return {
      n1: 10,
      n2: 10,
      n3: 10,
      pullupConfig2: {
        content: '上拉加载更多',
        downContent: '松开进行加载',
        upContent: '上拉加载更多',
        loadingContent: '加载中...'
      },
      status2: {
        pulldownStatus: 'default'
      }
    }
  },
  methods: {
    load1(done, uuid) {
      setTimeout(() => {
        this.n1 += 10
        done(100)
      }, 2000)
    },
    load2(done, uuid) {
      setTimeout(() => {
        this.n2 += 10
        done(100)
      }, 2000)
    },
    load3(done) {
      setTimeout(() => {
        this.n3 += 10
        done(100)
      }, 1500)
    }
  }
}
</script>
<style lang="less" scoped>
.box1 {
  height: 100px;
  position: relative;
  width: 1490px;
}

.box1-item {
  width: 200px;
  height: 100px;
  background-color: #ccc;
  display: inline-block;
  margin-left: 15px;
  float: left;
  text-align: center;
  line-height: 100px;
}

.box1-item:first-child {
  margin-left: 0;
}

.box2-wrap {
  height: 300px;
  overflow: hidden;
}

.rotate {
  display: inline-block;
  transform: rotate(-180deg);
}

.pullup-arrow {
  transition: all linear 0.2s;
  color: #666;
  font-size: 25px;
}

</style>
