May 19, 2021 WeChat Mini Program Development Document
Base library 1.9.0 starts to support, and low versions need to be compatible.
Displays the red dot in the upper right corner of an item of tabBar
Property | Type | The default | Required | Description |
---|---|---|---|---|
index | number | Is | TabBar's one, from the left | |
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | no | The callback function ended in the interface call (the call is successful, failed) |
The base library 1.9.0 began support, low version needs to be done Compatibility 。
Show tabbar
Attributes | type | Defaults | Required | illustrate |
---|---|---|---|---|
animation | boolean | false | no | Do you need an animation effect? |
success | function | no | Interface call successful callback function | |
fail | function | no | Interface call failed callback function | |
complete | function | no | The callback function ended in the interface call (the call is successful, failed) |
The base library 1.9.0 began support, low version needs to be done Compatibility 。
Dynamic setting TabBar's overall style
Attributes | type | Defaults | Required | illustrate |
---|---|---|---|---|
color | string | no | Word default color on Tab, HEXCOLOR | |
selectedColor | string | no | Colors of the text on tab, HEXCOLOR | |
backgroundColor | string | Whether | Tab background color, HexColor | |
borderStyle | string | Whether | The color of the border on tabBar, black/white only | |
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
wx.setTabBarStyle({
color: '#FF0000',
selectedColor: '#00FF00',
backgroundColor: '#0000FF',
borderStyle: 'white'
})
Base library 1.9.0 starts to support, and low versions need to be compatible.
Dynamically set tabBar content for an item, with 2.7.0 images supporting temporary and network files.
Property | Type | The default | Required | Description |
---|---|---|---|---|
index | number | Is | TabBar's one, from the left | |
text | string | Whether | The button text on tab | |
iconPath | string | Whether | Picture path, icon size limit is 40kb, recommended size is 81px x 81px, this parameter is not valid when postion is top | |
selectedIconPath | string | Whether | When the picture path is selected, the icon size is limited to 40kb, the recommended size is 81px x 81px, and this parameter is not valid when postion is top | |
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
wx.setTabBarItem({
index: 0,
text: 'text',
iconPath: '/path/to/iconPath',
selectedIconPath: '/path/to/selectedIconPath'
})
Base library 1.9.0 starts to support, and low versions need to be compatible.
Add text to the upper right corner of an item for tabBar
Property | Type | The default | Required | Description |
---|---|---|---|---|
index | number | Is | TabBar's one, from the left | |
text | string | Is | The text displayed, more than 4 characters, is displayed as ... | |
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
wx.setTabBarBadge({
index: 0,
text: '1'
})
Base library 1.9.0 starts to support, and low versions need to be compatible.
Remove the text in the upper right corner of an item in tabBar
Property | Type | The default | Required | Description |
---|---|---|---|---|
index | number | Is | TabBar's one, from the left | |
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
Base library 1.9.0 starts to support, and low versions need to be compatible.
Hides the red dot in the upper right corner of an item in tabBar
Property | Type | The default | Required | Description |
---|---|---|---|---|
index | number | Is | TabBar's one, from the left | |
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
Base library 1.9.0 starts to support, and low versions need to be compatible.
Hide tabBar
Property | Type | The default | Required | Description |
---|---|---|---|---|
animation | boolean | false | Whether | Whether an animation effect is required |
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |