better-scroll (下拉刷新、上拉加载)

1. 下载 better-scroll

npm install better-scroll --save

 

2.  html 要符合以下条件

<div class="wrapper"  ref="wrapper">
   <ul class="content">
      <li>...</li>
      <li>...</li>
      ...
  </ul>
  <!-- you can put some other DOMs here, it won't affect the scrolling -->
</div>

 

3.  在 style 下:

.wrapper
    overflow: hidden
    position: absolute
    bottom: 0
    left: 0
    right: 0
    top: 0

 

4.  在script 中引入 import BScroll from 'better-scroll'

 

5.  在 export default 引入:

mounted () {
  this.scroll = new BScroll(this.$refs.wrapper)
}

 

posted on 2018-07-24 11:20  素~  阅读(250)  评论(0编辑  收藏  举报