How to use the @better-scroll/core.use function in @better-scroll/core

To help you get started, we’ve selected a few @better-scroll/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qmhc / FlexTable / src / plugin / scroller / index.js View on Github external
BScroll.use(MouseWheel)

      options.mouseWheel = {
        speed: wheelDistance,
        invert: false,
        easeTime: 300
      }
    }

    if (!mouse) {
      options.click = false
      options.disableMouse = true
    }

    if (getType(pullup) === 'function') {
      BScroll.use(Pullup)

      const wrapper = temp.cloneNode()
      wrapper.classList.add('pullup-wrapper')

      const tip = spanTemp.cloneNode()
      tip.textContent = pullupTip || 'Loading...'

      wrapper.appendChild(tip)
      tbody.appendChild(wrapper)

      this.pullupWrapper = wrapper

      options.pullUpLoad = {
        threshold: parseInt(pullupThreshold) || 10
      }
    }
github ustbhuangyi / better-scroll / packages / better-scroll / src / index.ts View on Github external
import BetterScrollCore from '@better-scroll/core'
import MouseWheel from '@better-scroll/mouse-wheel'
import ObserveDom from '@better-scroll/observe-dom'
import PullDownRefresh from '@better-scroll/pull-down'
import PullUpLoad from '@better-scroll/pull-up'
import ScrollBar from '@better-scroll/scroll-bar'
import Slide from '@better-scroll/slide'
import Wheel from '@better-scroll/wheel'
import Zoom from '@better-scroll/zoom'
import NestedScroll from '@better-scroll/nested-scroll'
import InfinityScroll from '@better-scroll/infinity'

BetterScrollCore.use(MouseWheel)
  .use(ObserveDom)
  .use(PullDownRefresh)
  .use(PullUpLoad)
  .use(ScrollBar)
  .use(Slide)
  .use(Wheel)
  .use(Zoom)
  .use(NestedScroll)
  .use(InfinityScroll)

export default BetterScrollCore
github qmhc / FlexTable / src / plugin / scroller / index.js View on Github external
create () {
    const { table } = this.tableInstance
    const { height, wheel, mouse, wheelDistance, pullup, pullupThreshold, pullupTip } = this.state

    const scroller = table.querySelector('.it-tbody-group')
    const tbody = scroller.querySelector('.it-tbody')

    scroller.style.height = `${height}px`
    tbody.style.position = 'absolute'
    tbody.style.overflow = 'visible'

    const options = {}

    if (wheel) {
      BScroll.use(MouseWheel)

      options.mouseWheel = {
        speed: wheelDistance,
        invert: false,
        easeTime: 300
      }
    }

    if (!mouse) {
      options.click = false
      options.disableMouse = true
    }

    if (getType(pullup) === 'function') {
      BScroll.use(Pullup)