Bootstrap

Vue中better-scroll实现左右侧BScroll联动nextTick

better-scroll用法实现左右侧关联

Vue中better-scroll实现左右侧联动


```javascript
<script>
import BScroll from 'better-scroll'
export default {
  watch: {
    menus() {
      this.$nextTick(() => {        
        this._initRightLiTops()
this._initBScroll()
      })
    },
  },
  methods: {
    _initBScroll() {
      this.leftBScroll = new BScroll('.menu-left', {
        click: true,
        mouseWheel: true,
        probeType: 3,
      })
      this.rightBScroll = new BScroll('.menu-right', {
        click: true,
        mouseWheel: true,
        probeType: 3,
      })
      this.rightBScroll.on('scroll', (pos) => {
        var scrollY = Math.abs(pos.y)
        for (var i = 0; i < this.rightLiTops.length - 1; i++) {
          if (
            scrollY >= this.rightLiTops[i] &&
            scrollY < this.rightLiTops[i + 1]
          ) {
          

悦读

道可道,非常道;名可名,非常名。 无名,天地之始,有名,万物之母。 故常无欲,以观其妙,常有欲,以观其徼。 此两者,同出而异名,同谓之玄,玄之又玄,众妙之门。

;