has.showTabBar(Object object)
显示tabBar。
起始版本: 1.0.0
参数:
参数为Object对象,包括以下字段。
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| success | function | 否 | 接口调用成功的回调函数。 |
| fail | function | 否 | 接口调用失败的回调函数。 |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行)。 |
错误码信息:
| 错误码 | 错误信息 |
|---|---|
| 30000501 | showTabBar error. Possible causes: custom tabBar compId is invalid. 更多错误信息参考:Webview错误码。 |
示例:
has.showTabBar({
success: () => {
console.info('showTabBar success');
},
fail: (err) => {
console.error('showTabBar fail', err);
},
complete: (res) => {
console.info('showTabBar complete', res);
}
}); has.setTabBarBadge(Object object)
添加文本到tabBar某一项的右上角。
起始版本: 1.0.0
参数:
参数为Object对象,包括以下字段。
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| index | number | 是 | tabBar的哪一项,从左边算起,起始index为0。 |
| text | string | 是 | 显示的文本,超过4个字符长度则显示成··· 注意: 1. 中文字符、英文字符占一个字符。 2. 若text传入空字符串"",则tabBar指定项右上角不会显示红色角标。 |
| success | function | 否 | 接口调用成功的回调函数。 |
| fail | function | 否 | 接口调用失败的回调函数。 |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行)。 |
错误码信息:
| 错误码 | 错误信息 |
|---|---|
| 102 | Parameter error. Possible causes: 1.text is invalid. 2.index is out of range. |
| 30000701 | setTabBarBadge error. |
| 30000702 | custom tabBar forbidden to call. |
示例:
has.setTabBarBadge({
index: 1,
text: '123',
success: () => {
console.info('setTabBarBadge success');
},
fail: (err) => {
console.error('setTabBarBadge fail', err);
},
complete: (res) => {
console.info('setTabBarBadge complete', res);
}
}); has.removeTabBarBadge(Object object)
移除tabBar某一项右上角的文本。
起始版本: 1.0.0
参数:
参数为Object对象,包括以下字段。
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| index | number | 是 | tabBar的哪一项,从左边算起,起始index为0。 |
| success | function | 否 | 接口调用成功的回调函数。 |
| fail | function | 否 | 接口调用失败的回调函数。 |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行)。 |
错误码信息:
| 错误码 | 错误信息 |
|---|---|
| 102 | Parameter error. Possible causes: index is out of range. |
| 30000801 | custom tabBar forbidden to call. |
| 30000802 | removeTabBarBadge error. |
示例:
has.removeTabBarBadge({
index: 1,
success: () => {
console.info('removeTabBarBadge success');
},
fail: (err) => {
console.error('removeTabBarBadge fail', err);
},
complete: (res) => {
console.info('removeTabBarBadge complete', res);
}
}); has.hideTabBar(Object object)
隐藏tabBar。
起始版本: 1.0.0
参数:
参数为Object对象,包括以下字段。
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| success | function | 否 | 接口调用成功的回调函数。 |
| fail | function | 否 | 接口调用失败的回调函数。 |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行)。 |
错误码信息:
| 错误码 | 错误信息 |
|---|---|
| 30000601 | hideTabBar error. Possible causes: custom tabBar compId is invalid. 更多错误信息参考:Webview错误码。 |
示例:
has.hideTabBar({
success: () => {
console.info('hideTabBar success');
},
fail: (err) => {
console.error('hideTabBar fail', err);
},
complete: (res) => {
console.info('hideTabBar complete', res);
}
}); has.showTabBarRedDot(Object object)
显示tabBar某一项的右上角的红点。
起始版本: 1.0.15
参数:
参数为Object对象,包括以下字段。
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| index | number | 是 | tabBar的哪一项,从左边算起,起始index为0。 |
| success | function | 否 | 接口调用成功的回调函数。 |
| fail | function | 否 | 接口调用失败的回调函数。 |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行)。 |
错误码信息:
| 错误码 | 错误信息 |
|---|---|
| 102 | Parameter error. Possible causes: index is out of range. |
| 30001601 | custom tabBar forbidden to call. |
| 30001602 | showTabBarRedDot error. |
示例:
has.showTabBarRedDot({
index: 0,
success: () => {
console.info('showTabBarRedDot success');
},
fail: (err) => {
console.error('showTabBarRedDot fail', err);
},
complete: (res) => {
console.info('showTabBarRedDot complete', res);
}
}); has.hideTabBarRedDot(Object object)
隐藏tabBar某一项的右上角的红点。
起始版本: 1.0.15
参数:
参数为Object对象,包括以下字段。
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| index | number | 是 | tabBar的哪一项,从左边算起,起始index为0。 |
| success | function | 否 | 接口调用成功的回调函数。 |
| fail | function | 否 | 接口调用失败的回调函数。 |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行)。 |
错误码信息:
| 错误码 | 错误信息 |
|---|---|
| 102 | Parameter error. Possible causes: index is out of range. |
| 30001701 | custom tabBar forbidden to call. |
| 30001702 | hideTabBarRedDot error. |
示例:
has.hideTabBarRedDot({
index: 0,
success: () => {
console.info('hideTabBarRedDot success');
},
fail: (err) => {
console.error('hideTabBarRedDot fail', err);
},
complete: (res) => {
console.info('hideTabBarRedDot complete', res);
}
}); has.setTabBarStyle(Object object)
动态设置tabBar的整体样式。
起始版本: 1.0.15
参数:
参数为Object对象,包括以下字段。
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| color | string | 否 | tab上的文字默认颜色,HexColor。 |
| selectedColor | string | 否 | tab上的文字选中时的颜色,HexColor。 |
| backgroundColor | string | 否 | tab的背景色,HexColor。 |
| borderStyle | string | 否 | tabBar上边框的颜色,仅支持black/white。 |
| success | function | 否 | 接口调用成功的回调函数。 |
| fail | function | 否 | 接口调用失败的回调函数。 |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行)。 |
错误码信息:
| 错误码 | 错误信息 |
|---|---|
| 102 | Parameter error. Possible causes: 1.color is invalid. 2.invalid borderStyle. |
| 30001801 | setTabBarStyle error. |
| 30001802 | custom tabBar forbidden to call. |
示例:
has.setTabBarStyle({
color: '#FF0000',
success: () => {
console.info('setTabBarStyle success');
},
fail: (err) => {
console.error('setTabBarStyle fail', err);
},
complete: (res) => {
console.info('setTabBarStyle complete', res);
}
}); has.setTabBarItem(Object object)
动态设置tabBar某一项的内容。
起始版本: 1.0.15
参数:
参数为Object对象,包括以下字段。
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| index | number | 是 | tabBar的哪一项,从左边算起,起始index为0。 |
| text | string | 否 | tab上的按钮文字。 |
| iconPath | string | 否 | 图片路径,icon大小限制为40kb,建议尺寸为81px * 81px,不支持网络图片。 |
| selectedIconPath | string | 否 | 选中时的图片路径,icon大小限制为40kb,建议尺寸为81px * 81px,不支持网络图片。 |
| success | function | 否 | 接口调用成功的回调函数。 |
| fail | function | 否 | 接口调用失败的回调函数。 |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行)。 |
错误码信息:
| 错误码 | 错误信息 |
|---|---|
| 102 | Parameter error. Possible causes: 1.index is out of range. 2.network icons are not currently supported. 3.iconPath is not exist. |
| 30001901 | setNavigationBarColor error. |
| 30001902 | custom tabBar forbidden to call. |
示例:
has.setTabBarItem({
index: 1,
text: 'text',
success: () => {
console.info('setTabBarItem success');
},
fail: (err) => {
console.error('setTabBarItem fail', err);
},
complete: (res) => {
console.info('setTabBarItem complete', res);
}
});