背景
setBackgroundColor
TIP
該API使用方法為: wx.setBackgroundColor(Object object)
- 功能說明: 動態設定視窗的背景色。
- 參數及說明: Object object
| 内容 | 類型 | 預設值 | 必填 | 說明 |
|---|---|---|---|---|
| backgroundColor | string | - | 否 | 視窗的背景色,必須為十六進位顏色值 |
| backgroundColorTop | string | - | 否 | 頂部視窗的背景色,必須為十六進位顏色值,僅iOS支持 |
| backgroundColorBottom | string | - | 否 | 底部視窗的背景色,必須為十六進位顏色值,僅iOS支持 |
| success | Function | - | 否 | 接口調用成功的回呼函數 |
| fail | Function | - | 否 | 接口調用失敗的回呼函數 |
| complete | Function | - | 否 | 接口調用結束的回呼函數(無論成功與否都執行) |
- 示例代碼:
js
wx.setBackgroundColor({
backgroundColor: '#ffffff', // The background color of the window is white.
})
wx.setBackgroundColor({
backgroundColorTop: '#ffffff', // The background color of the top window is white.
backgroundColorBottom: '#ffffff', // The background color of the bottom window is white.
})setBackgroundTextStyle
TIP
該API使用方法為: wx.setBackgroundTextStyle(Object object)
- 功能說明: 動態設定下拉背景字體、loading圖的樣式。
- 參數及說明: Object object
| 内容 | 類型 | 預設值 | 必填 | 說明 |
|---|---|---|---|---|
| textStyle | string | - | 是 | 下拉背景字體、loading圖的樣式 |
| success | Function | - | 否 | 接口調用成功的回呼函數 |
| fail | Function | - | 否 | 接口調用失敗的回呼函數 |
| complete | Function | - | 否 | 接口調用結束的回呼函數(無論成功與否都執行) |
object.textStyle的合法值
值 說明 dark dark樣式 light light樣式 示例代碼:
js
wx.setBackgroundTextStyle({
textStyle: 'dark' // The dropdown background text and loading icon styles are set to dark.
})