小程序动态修改导航栏样式navigationBarBackgroundColor

官方文档

https://developers.weixin.qq.com/miniprogram/dev/api/wx.setNavigationBarColor.html

wx.setNavigationBarColor({

frontColor: '#ffffff',

backgroundColor: '#ff0000',

})

颜色一定要是16进制,不能使用rgb,rgba,16进制简写‘#fff’!

或者在当前页面的json进行修改

{

"navigationBarTitleText": "我的",

"backgroundTextStyle": "light",

"navigationBarBackgroundColor": "#5882F5",

"navigationBarTextStyle": "white"

}

猜你喜欢

转载自blog.csdn.net/CrazBarry/article/details/90173529