Vue Mobile better-scroll

use the better-scroll plug-in to achieve the effect of x-axis sliding.
refers to https://zhuanlan.zhihu.com/p/.
, which says that the data in the
list is often obtained asynchronously, so we need to initialize the better-scroll after
this code is the layout
< div slot=" content "class=" tips product_button wrapper "ref=" wrapper ">

.
        <div class="scrool_content">
          <checker v-model="checkedMembers" type="checkbox" default-item-class="demo1-item" @on-change="memberChange" selected-item-class="demo1-item-selected">
            <checker-item v-for="item in members" @on-item-click="itemClick" :disabled="isTip" :key="item.personid" :value="item">
              {{item.name}}
            </checker-item>
          </checker>
      </div>
    </div>

the effect of the layout above
clipboard.png

better-scroll 
 created() {
  requestData().then((res) => {
    this.data = res.data
    this.$nextTick(() => {
      this.scroll = new Bscroll(this.$refs.wrapper, {})
    })
  })
}
, 
ref="wrapper",better-scroll

Apr.09,2021

first of all, you do not need to obtain the ref= "wrapper". The attribute ref is equivalent to the corresponding dom
that can be obtained directly through the "this.$refs.ref name" in id,vue. Secondly, initializing in that method, as you mentioned earlier, after data acquisition, the general data is obtained in the form of ajax or promise and initialized in the corresponding success or then. Because by this time the data you need has been returned

Menu