Skip to content

Background

setBackgroundColor

TIP

The API usage is as follows: wx.setBackgroundColor(Object object)

  • Functional description: Dynamically set the background color of the window.
  • Parameters and descriptions: Object object
PropertiesTypeDefault valueRequiredDescription
backgroundColorstring-NoThe background color of the window must be a hexadecimal color value
backgroundColorTopstring-NoThe background color of the top window must be a hexadecimal color value, only supported by iOS
backgroundColorBottomstring-NoThe background color of the bottom window must be a hexadecimal color value, only supported by iOS
successFunction-NoCallback function for successful interface call
failFunction-NoCallback function for failed interface call
completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • Sample code:
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

The API usage is as follows: wx.setBackgroundTextStyle(Object object)

  • Functional description: Dynamically set the style of the drop-down background font and loading image.
  • Parameters and descriptions: Object object
PropertiesTypeDefault valueRequiredDescription
textStylestring-YesThe style of the drop-down background font and loading image
successFunction-NoCallback function for successful interface call
failFunction-NoCallback function for failed interface call
completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • Legal values

    ValueDescription
    darkdark style
    lightlight style
  • Sample code:

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