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

1. 下载 better-scroll

npm install better-scroll --save

2.  html 要符合以下条件

<div class="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 引入:

export default {
    mounted () {
      this.scroll = new Bscroll(this.$refs.wrapper)
    }
}

猜你喜欢

转载自www.cnblogs.com/jy13638593346/p/9358942.html