0.1.2 • Published 6 years ago

vs-scroll v0.1.2

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

vs-scroll

Set up

npm install vs-scroll --save

Usage

main.js

import Vue from 'vue'
import Scroll from 'vs-scroll'

Vue.use(Scroll)

App.vue

<template>
  <div id="app">
    <Scroll :height="500">
      <ul class="list">
        <li
          v-for="n in listsize"
          :key="n"
          class="list-item"
        >
          {{ `${n} 这是一段文字这是一段文字这是一段文字` }}
        </li>
      </ul>
      <!-- <template #scrollbar="{ x, y }">
        <span :style="{position: 'absolute', top: '5px', right: '5px'}">{{ `${x}, ${y}` }}</span>
      </template> -->
    </Scroll>
  </div>
</template>

<script>
import Scroll from './components/scroll'

export default {
  data () {
    return {
      listsize: 500,
      height: 500
    }
  }
}
</script>

Props

PropertyDesciptionTypeDefault
enabledWhether to enabled ths Scroll.Booleantrue
delta-xScroll distance in the x direction.String | Number100
delta-yScroll distance in the y direction.String | Number100
widthThe width of wrapper, it will be displayed as a percentage when the value less than 100, otherwise it is a pixel.String | Number100
heightThe height of wrapper, it will be displayed as a percentage when the value less than 100, otherwise it is a pixel.String | Number300
fadeWhether scrollbar will hide automatically when mouse leave the wrapper.Booleantrue
wheelUsing wheel to control scroll.Booleantrue
mouseUsing mouse to control scroll.Booleantrue
touchAdd touch events on content, generally used for mobile, now only supports single pointer.Booleanfalse
scrollbarUse scrollbar, it can be an Object with x and y property to control the scrollbars of x or y direction respectively.Boolean { Object{ x: false, y: true }
regulationIt is an Object with delay, interval, leading and trailing property to throttle and debounce scroll event.Object{}

License

MIT

Copyright (c) 2019-present, vs-scroll