網上資料解決雜亂不一,特意一補
為page標簽設置wxss樣式
overflow-y: hidden;overflow-x:hidden;
然后在wxml中設置標簽
<!--固定定位不動的內容-->
......
<!--需要上下左右滑動的內容-->
<scroll-view style="height: {{windowHeight}}px; width:{{windowWidth}}px;" scroll-y="true"?scroll-x="true">
.......
</scroll-view>
在wxml中的兩個變量js中設置(自己可以調整scroll-view寬高拯啦,我這里循例發(fā)出來給你們看而已)
var page_this = this;
wx.getSystemInfo({
? ? success: (res) => {
? ? ? ? page_this.setData({
? ? ? ? ? windowHeight: res.windowHeight,
? ? ? ? ? windowWidth: res.windowWidth,
? ? ? ? ? windowIsBang: (res.windowWidth/res.windowHeight<0.5 ? true : false)//判斷手機是否有劉海屏
? ? ? ? })
? ? }
})