ScrollView的全屏高度滚动监听

发布于 8 年前作者 rxiang16781 次浏览最后编辑 8 年前来自 ask

因为要给scrollView一个全屏的大小 然后又要监听事件 如果直接设为1334 会有一些莫名其妙的BUG 因为导航栏占用了64px,系统自己做了一个外部滑动好像是这样 但是导致监听事件紊乱,当滑到低于xx位置的时候回调无法触发。1334rpx-64px做法又不行 我有点感觉绝望

或者哪位大佬能知道 如何获取到位于导航栏和tabbar之间的确定的rpx数值

10 回复
jingyi
jingyi1 楼6 年前

当然我知道我设置id准备使用H5的方法获取view的做法可能很煞笔

caichao
caichao2 楼6 年前

你的目的不是获取navigationBar到tabbar之间的距离吗?

wx.getSystemInfo({
  success: function(res) {
    console.log(res.model)
    console.log(res.pixelRatio)
    console.log(res.windowWidth)
    console.log(res.windowHeight)
    console.log(res.language)
    console.log(res.version)
    console.log(res.platform)
  }
})

他返回的windowHeight就是这个距离,单位是px

mdong
mdong3 楼6 年前

我想 我可能需要把问题重新描述一遍 了

<scroll-view style=“height: {{scrollViewContent}};” id=“1” scroll-y bindscroll=“scroll” bindscrolltoupper=“upper”>

这是我的样式代码

onLoad: function (options)

{

var res = wx.getSystemInfoSync();

console.log(res.windowHeight);

},

这是我获取高度的代码

data: {

indicatorDots: true,

。。。(省略n多信息)

scrollViewContent: 1000px,

},

这是我js中的数据

我知道我没有将数据放进去 但是在第一步绑定的时候就出现了问题

qiang27
qiang274 楼6 年前

如果你只是想设置scrollView高度为可用全屏的话

page{
    height:100%;
}
scroll-view{
    height:100%;
}
txia
txia5 楼6 年前

对啊 或许 我表达的不够清晰

我并不知道 怎么能够设置那个view的高度

alu
alu6 楼6 年前

我认为,你应该改成

style=“height: {{scrollViewContent}}px;”

data: {

indicatorDots: true,

。。。(省略n多信息)

scrollViewContent: 1000,

},

kfang
kfang8 楼6 年前

虽然我很想展现得 我知道怎么做了 但是我到现在还是不知道 怎么做

_(:з」∠)_

xiulan76
xiulan769 楼6 年前

万分感谢

gang48
gang4810 楼6 年前

能给个demo地址吗 我连获取控件的办法都是没找到