dlt.setTabBarStyle
Introduction
Dynamically set the overall style of the tabBar.
Usage Limitations
Supported in the basic library version 4.0.0 or higher.
Parameters
Object object
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| color | string | No | Default color of the text on the tab, HexColor. | |
| selectedColor | string | No | Color of the text on the tab when selected, HexColor. | |
| backgroundColor | string | No | Background color of the tab, HexColor. | |
| borderStyle | string | No | Color of the top border on the tabBar, only supports 'black' or 'white'. | |
| success | function | No | Callback function for a successful API call. | |
| fail | function | No | Callback function for a failed API call. | |
| complete | function | No | Callback function for the completion of the API call (executed whether the call is successful or not). |
object.success Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | string | true - Setting successful. |
object.fail Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | string | false - Setting failed. |
Sample Code
// pages/index/index.js
Page({
setTabBarStyle() {
dlt.setTabBarStyle({
color: '#2E74FF',
selectedColor: '#35c208',
backgroundColor: '#c2c6ce',
borderStyle: 'white',
success: () => {
console.log('success');
},
});
},
});