微信小程序中有很多可以在.json文件設置的屬性,包括設置小程序的狀態欄、導航條、標題、窗口背景色等,
window
屬性 | 類型 | 默認值 | 描述 |
---|---|---|---|
navigationBarBackgroundColor | HexColor | 000000 | 導航欄背景顏色,如”#000000” |
navigationBarTextStyle | String | white | 導航欄標題顏色,僅支持 black/white |
navigationBarTitleText | String | 導航欄標題文字內容 | |
navigationStyle | String | default | 導航欄樣式,僅支持 default/custom。custom 模式可自定義導航欄,只保留右上角膠囊狀的按鈕 |
backgroundColor | HexColor | ffffff | 窗口的背景色 |
backgroundTextStyle | String | dark | 下拉 loading 的樣式,僅支持 dark/light |
backgroundColorTop | String | ffffff | 頂部窗口的背景色,僅 iOS 支持 |
backgroundColorBottom | String | ffffff | 底部窗口的背景色,僅 iOS 支持 |
enablePullDownRefresh | Boolean | false | 是否開啟下拉刷新 |
onReachBottomDistance | Number | 50 | 頁面上拉觸底事件觸發時距頁面底部距離,單位為px |
注:HexColor(十六進制顏色值),如”#ff00ff”
注:navigationStyle 只在 app.json 中生效。開啟 custom 后,低版本客戶端需要做好兼容
- {
- "navigationBarTitleText": "對戰",
- "enablePullDownRefresh": false,
- "disableScroll": true,
- "usingComponents": {
- "dialog": "/components/dialog/index"
- }
- }
新聞熱點
疑難解答