setTabBarBadge

版本要求:
MiniKit≥1.0.0@ray-js/ray≥0.3.23
支持平台:
iOSAndroid
import { setTabBarBadge } from '@ray-js/ray';

// Promise 调用
try {
  const res = await setTabBarBadge({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

方法签名
setTabBarBadge(params: )

描述

为 tabBar 某一项的右上角添加文本

参数

属性类型必填说明
indexnumber是tabBar 的哪一项,从左边算起
textstring是显示的文本,超过 4 个字符则显示成 ...
complete() => void否接口调用结束的回调函数(调用成功、失败都会执行)
success() => void否接口调用成功的回调函数
fail(params: Object) => void否接口调用失败的回调函数
fail 回调参数
属性类型说明
errorMsgstring错误信息
errorCodestring | number错误码
错误扩展

返回值

无

示例代码

import { setTabBarBadge } from '@ray-js/ray'

setTabBarBadge({
  index: 0,
  text: "99",
  success: data => { console.log(data); },
  fail: error => { console.error(error); },
});