---
nav: default
---
### Scroller
<img width="100" src="http://qr.topscan.com/api.php?text=demo%2F%23%2Fcomponent%2Fscroller"/>
<a href="demo/#/component/scroller" target="_blank" style="font-size:12px;color:#888;">demo 原始链接：demo/#/component/scroller</a>


---
#### 演示
<div style="width:377px;height:667px;display:inline-block;border:1px dashed #ececec;border-radius:5px;overflow:hidden;">
<iframe src="demo/#/component/scroller" width="375" height="667" border="0" frameborder="0"></iframe>
</div>
#### demo 代码

``` html
<template>
  <div>
    <divider>A Horizontal Scroller without Scrollbar</divider>
    <scroller
      lock-y
      :scrollbar-x="false"
    >
      <div class="box1">
        <div
          v-for="i in 100"
          :key="i"
          class="box1-item"
        >
          <span>{{ ' ' + i + ' ' }}</span>
        </div>
      </div>
    </scroller>

    <divider>A Horizontal Scroller with Scrollbar</divider>
    <scroller
      lock-y
      scrollbar-x
    >
      <div class="box1">
        <div
          v-for="i in 7"
          :key="i"
          class="box1-item"
        >
          <span>{{ ' ' + i + ' ' }}</span>
        </div>
      </div>
    </scroller>

    <divider>A Horizontal Scroller without bounce effect</divider>
    <scroller
      lock-y
      scrollbar-x
      :bounce="false"
    >
      <div class="box1">
        <div
          v-for="i in 7"
          :key="i"
          class="box1-item"
        >
          <span>{{ ' ' + i + ' ' }}</span>
        </div>
      </div>
    </scroller>

    <divider>A Vertical Scroller</divider>
    <scroller
      lock-x
      height="200px"
    >
      <div class="box2">
        <p
          v-for="i in 80"
          :key="i"
        >
          placeholder {{ i }}
        </p>
      </div>
    </scroller>

    <divider>A Vertical Scroller with scrollbar y</divider>
    <scroller
      ref="scroller"
      lock-x
      scrollbar-y
      height="200px"
      :prevent-default="false"
    >
      <div class="box2">
        <div v-if="showList1">
          <p
            v-for="i in 80"
            :key="i"
          >
            placeholder {{ i }}
          </p>
        </div>
        <div v-if="!showList1">
          <p
            v-for="i in 10"
            :key="i"
          >
            placeholder {{ i }}
          </p>
        </div>
        <x-button
          style="margin:10px 0;"
          type="primary"
        >
          Button
        </x-button>
      </div>
    </scroller>
    <x-button
      type="primary"
      @click="changeList"
    >
      show another list
    </x-button>
  </div>
</template>

<script>
import { Scroller, Divider, XButton } from '../components/_index'

export default {
  components: {
    Scroller,
    Divider,
    XButton
  },
  data () {
    return {
      showList1: true
    }
  },
  methods: {
    changeList () {
      this.showList1 = false
      this.$nextTick(() => {
        this.$refs.scroller.reset({
          top: 0
        })
      })
    }
  }
}
</script>

<style scoped>
.box1 {
  height: 100px;
  position: relative;
  width: 21500px;
}
.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;
}
</style>

```

#### Github Issue