scroll-view
发布于 5 年前 作者 xiaochao 7168 次浏览 来自 问答

有的手机有时候   整个scroll-view会上移  导致头部几个分类看不见了

同一个手机 有时候行有时候不行

wxml:

<scroll-view class=‘fir-cate’ scroll-y style=“height: {{windowHeight}}px;”>

<block wx:for="{{cateList}}" wx:key=“k”>

<view bindtap=‘bindFirCate’ data-cid="{{item.id}}" data-index="{{index}}" class=“scroll-view-item {{index == firIdx ? ‘on’:’’}}”>{{item.name}}</view>

</block>

</scroll-view>

js:

wx.getSystemInfo({

    success: function (res) {

        that.setData({ windowHeight: res.windowHeight })

        console.log(res.windowHeight)

    }

})

wxss:

.fir-cate{

width: 25%;

border-right: 1px solid #e4e4e4;

position: fixed;

top: 0;

}

.fir-cate .scroll-view-item{

height: 40px;

line-height: 40px;

text-align: center;

background: #F5F5F5;

border-bottom:1px solid #fff;

}

.fir-cate .on{

background: #fff;

color: #6E4EB9;

border-left: 3px solid #6E4EB9

}

回到顶部