Dynamically set the background color and pull-down text style of a mini program window.
my.setBackgroundColor
Available in mPaaS 10.1.32 and later.
Dynamically sets the background color of the window.
Parameters
|
Name |
Type |
Required |
Description |
|
backgroundColor |
HexColor |
Yes |
Window background color. |
|
backgroundColorTop |
HexColor |
Yes |
Top window background color. iOS only. |
|
backgroundColorBottom |
HexColor |
Yes |
Bottom window background color. iOS only. |
|
success |
Function |
No |
Callback on success. |
|
fail |
Function |
No |
Callback on failure. |
|
complete |
Function |
No |
Callback on completion, regardless of result. |
Example
/*Set the window background color*/
my.setBackgroundColor({
backgroundColor: '#ffffff'
})
/*Set the background colors for the top and bottom windows separately*/
my.setBackgroundColor({
backgroundColorTop: '#ffffff',
backgroundColorBottom: '#ffffff'
})
my.setBackgroundTextStyle
Available in mPaaS 10.1.32 and later.
Dynamically sets the font and loading graphic style for the pull-down background.
Parameters
|
Name |
Type |
Required |
Description |
|
textStyle |
String |
Yes |
Font and loading graphic style for the pull-down background. Valid values: |
|
success |
Function |
No |
Callback on success. |
|
fail |
Function |
No |
Callback on failure. |
|
complete |
Function |
No |
Callback on completion, regardless of result. |
Example
my.setBackgroundTextStyle({
textStyle: 'dark', // Set the font and loading graphic style to dark.
})