모 바 일 브 라 우 저 에서 better-scroll 에서 click 이벤트,링크 가 잘못 되 었 습 니 다.

2711 단어 vuejs
현재 대부분의 vuejs.프로젝트 는 better-scroll 을 사용 합 니 다.
그러나 대부분 큰 div 에 있 는 a 링크 나 click 사건 을 사용 하지 않 는 다 는 문제 가 발생 합 니 다.
html 부분 입 니 다.
 <div ref="wrapper" class="list-wrapper">
      <div class="setting-list" ref="setting" >
        <div class="setting-list-li" v-for="(value,key) in theme">
          to="`/theme/${value.c_type}`" @click.native="change" class="item">
          
        div>
      div>
    div>

js 부분 입 니 다.
 import BScroll from 'better-scroll'

  export default {
    mounted () {
      this.$nextTick(function () {
        setTimeout(() => {
          const options = {
            scrollY: false, //   scrollY   true,      
            scrollX: true,
            mouseWheel: true,
            click: true,
            taps: true
          }
          this.scroll = new BScroll(this.$refs.wrapper, options)
        }, 20)
      })
    }
  }

better-scroll 은 원생 의 click 사건 을 막 기 때문에 tap 를 true 로 설정 할 수 있 습 니 다.영역 이 클릭 되 었 을 때 tap 사건 을 보 냅 니 다.
더 많은 매개 변 수 는 여 기 를 볼 수 있 습 니 다:문서https://ustbhuangyi.github.io/better-scroll/doc/zh-hans/options.html#starty

좋은 웹페이지 즐겨찾기