better-scroll 不能横向滚动,求助!

<div class="tab" ref="tab">

  <div class="tab_content">
      <div class="tab_item" v-for="(item,index) in menuList" :key="index">
          {{item.name}}
      </div>
  </div>

</div>

props: {
// 首页传过来的tab的值
menuList:null,
},

methods: {

  onScroll(){
        this.$nextTick(()=>{
            if (!this.scroll) {
                this.scroll=new BScroll(this.$refs.tab, {
                    startX:0,
                    click:true,
                    scrollX:true,
                    scrollY:false,
                })
            }else{
                this.scroll.refresh()
            }
        })
    }
},
 mounted () {
  this.onScroll()
}
<style>

.tab{

width: 7.54rem;
height: 0.88rem;
background: #fff;
overflow: hidden;

}
.tab_item{

display: inline-block;
height: 0.88rem;
line-height: 0.888rem;
padding: 0 0.466667rem;

}
</style>

阅读 1.7k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题