• JS API 列表
  • 基础
  • TTML
  • 网络
  • 媒体
  • 地图
  • 文件
  • 数据缓存
  • 地理位置
  • 设备
  • 画布
  • 界面
  • 页面导航
  • 开放接口
  • 行业开放
  • 交易系统
  • 通用交易系统
  • 交易工具
  • tt.sign
  • tt.createSignOrder
  • diamond-balance钻石充值与余额组件
  • 第三方平台
  • 其它
  • diamond-balance钻石充值与余额组件
    收藏
    我的收藏

    使用说明

    开发者可将此组件引入用于展示用户钻石余额信息和完成钻石充值流程。

    效果示例

    使用限制

    仅在行业 SDK 上才支持,需要在代码中配置行业 SDK 的权限:行业 SDK 的权限配置,使用前必须通过 tt.canIUse 来校验当前客户端能否使用。
      支持设备:iOS。
      支持宿主版本:抖音32.4.0及以上版本。
    tt.canIUse('diamond-balance')

    参数说明

    属性名
    类型
    默认值
    必填
    说明
    custom-style
    object
    自定义样式,详见下文说明
    bind:error
    EventHandle
    组件传入属性异常、组件内部发生异常时触发
    bind:success
    EventHandle
    用户钻石余额充值成功回调

    custom-style 说明

    属性名
    类型
    默认值
    必填
    说明
    fontSize
    string
    组件文字大小
    fontColor
    string
    组件文字颜色
    logoWidth
    string
    抖音钻石图标宽度
    logoHeight
    string
    抖音钻石图标高度
    arrowWidth
    object
    箭头宽度
    arrowHeight
    object
    箭头高度

    bind:error 错误说明

    属性名
    类型
    说明
    21550
    User is not login
    用户未登录
    174701
    Fail to get user balance info
    获取用户余额信息失败
    174703
    only support iOS
    仅支持ios客户端使用

    扫码体验

    无。

    代码示例

      1.页面 json 引入。
    { "usingComponents": { "diamond-balance": "ext://industry/diamond-balance" } }
      2.ttml 引入组件,使用 tt.canIUse('diamond-balance') 判断是否支持组件。
    <diamond-balance bind:error="handleError" bind:success="handleSuccess" />
      3.实现 bind:success 回调。
    // bind:success 使用示例 handleSuccess(event) { // 用户充值成功提示 }
      4.实现 bind:error 回调。
    // bind:error 使用示例 handleError(event){ // errNo(错误码,对应某种具体报错原因) // errMsg(报错信息) const { errNo, errMsg } = event.detail this.setData({ show: false }) }

    Bug & Tip

    无。