Skip to content

背景

setBackgroundColor

TIP

該API使用方法為: wx.setBackgroundColor(Object object)

  • 功能說明: 動態設定視窗的背景色。
  • 參數及說明: Object object
内容類型預設值必填說明
backgroundColorstring-視窗的背景色,必須為十六進位顏色值
backgroundColorTopstring-頂部視窗的背景色,必須為十六進位顏色值,僅iOS支持
backgroundColorBottomstring-底部視窗的背景色,必須為十六進位顏色值,僅iOS支持
successFunction-接口調用成功的回呼函數
failFunction-接口調用失敗的回呼函數
completeFunction-接口調用結束的回呼函數(無論成功與否都執行)
  • 示例代碼:
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
内容類型預設值必填說明
textStylestring-下拉背景字體、loading圖的樣式
successFunction-接口調用成功的回呼函數
failFunction-接口調用失敗的回呼函數
completeFunction-接口調用結束的回呼函數(無論成功與否都執行)
  • object.textStyle的合法值

    說明
    darkdark樣式
    lightlight樣式
  • 示例代碼:

js
wx.setBackgroundTextStyle({
    textStyle: 'dark' // The dropdown background text and loading icon styles are set to dark.
})