ios设置窗口背景色wx.setBackgroundColor()
发布于 5 年前 作者 jie26 19257 次浏览 来自 问答

wx.setBackgroundColor({

backgroundColorTop: ‘#ff98be’, // 顶部窗口的背景色为白色

backgroundColorBottom: ‘#ffffff’, // 底部窗口的背景色为白色

})

得到的效果顶部窗口是白色没有改变

3 回复

官方文档的iOS设置上下背景异色,在iPhone xs max下确实有问题。

  1. 先设置背景色,然后再设置底部颜色,成功生效;
wx.setBackgroundColor({
    backgroundColor:  topColor,
    backgroundColorBottom: bottomColor
})

2. 若要按官方文档设置backgroundColorTop,在onLoad/onShow事件中则必须要加延时,且不确定延时时长,可能会失效。

setTimeout(() => {
    wx.setBackgroundColor({
        backgroundColorTop:  topColor,
        backgroundColorBottom: bottomColor
    })
},  300); // 保险起见设置了300ms

我设置{  “disableScroll”:true

}也是无效

回到顶部