0.1.9 • Published 2 years ago

y-scrollbar v0.1.9

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

@weier/w-scrollbar

  • 滚动条容器
// 安装
npm i @weier/w-scrollbar -S

// 代码引入(可选)
import Vue from 'vue'
import WScrollbar from '@weier/w-scrollbar'
Vue.use(WScrollbar)

基础用法

容器外的宽高需已知(可滚动即可) noresize 如果 container 尺寸不会发生变化,最好设置它可以优化性能

:::demo

import { defineComponent } from '@vue/composition-api'
import WScrollbar from '@weier/w-scrollbar'

export default defineComponent({
  setup() {

  },
  render() {
    const n = []
    for (let i = 0; i < 100; i++) {
      n.push(i)
    }
    return (
       <div class="WScrollbar-father" style={{
        height: '200px',
        border: '1px dashed #dedede'
       }}>
        <WScrollbar autoShow={false}>
          <ul class="content" style="width: 120%">
            {
              n.map(index => <li key={index}>{index}</li>)
            }
          </ul>
        </WScrollbar>
      </div>
    )
  }
})

:::

w-scrollbar Attributes

参数说明类型可选值默认值
zIndex滚动条层级Number——1
autoShow是否移入时显示Booleantrue/falsetrue
light滚动条的颜色是否亮色Booleantrue/falsefalse
noresize如果 container 尺寸不会发生变化,最好设置它可以优化性能Booleantrue/falsefalse

w-scrollbar Events

事件名称说明参数
reach-top到达顶部
reach-bottom到达底部
reach-left到达最左边
reach-right到达最右边
scroll鼠标滚动时触发scrollInfo(Object)

scrollInfo 参数

参数说明类型
scrollTop当前滚动容器的scrollTopNumber
scrollLeft当前滚动容器的scrollLeftNumber

w-scrollbar Methods

方法名说明参数
scrollTo滚动容器至-位置scrollTop(top/bottom/left/right/end/(Number)), scrollLeft(Number)(可选)

w-scrollbar-slot

参数说明类型可选值默认值
默认值默认内容——————
0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago