vue中引用BScroll监听上拉加载报错

项目场景:

项目场景:使用better-scroll2.0.4替代原生滚动,原因:原生滚动在移动端体验差,卡顿感强烈。


问题描述:

报错:vue中引用BScroll监听上拉加载报错_第1张图片

mounted() {
     
      this.scroll = new BScroll(this.$refs.wrapper,{
     
        probeType:this.probeType,
        click:true,
        pullUpLoad:this.pullUpLoad
      })
      if (this.probeType === 2 || this.probeType === 3) {
     
        this.scroll.on('scroll', (position) => {
     
          this.$emit('scroll', position)
        })
      }
      if (this.pullUpLoad) {
     
        this.scroll.on('pullingUp',()=>{
     
          this.$emit('pullingUp')
        })
      }

    },

原因分析:

没有安装pullup这个插件


解决方案:

安装插件:

  npm install @better-scroll/pull-up@next --save

引用插件:

  import BScroll from "@better-scroll/core"
  import Pullup from '@better-scroll/pull-up'

  BScroll.use(Pullup)

你可能感兴趣的:(Vue,vue.js,javascript,npm)