抖音开放平台Logo
开发者文档
“/”唤起搜索
控制台

tt.showLoading
收藏
我的收藏

基础库 1.0.0 开始支持本方法,这是一个异步方法。

显示灰色背景的 loading 提示框。该提示框不会主动隐藏。

前提条件无
业务背景无
使用限制无
注意事项
  • loading 的实现基于 toast,等同于 icon 为 loading,duration 为 24小时 的 toast;
  • 多次弹出 loading 时,后一个会立刻覆盖前一个。
支持沙盒
否
相关教程无

语法

tt.showLoading(options)

参数说明

options 为 object 类型,属性如下:

属性名类型默认值必填说明最低支持版本
maskbooleanfalse否
是否显示透明蒙层,防止触摸穿透
2.47.0
titlestring是
内容,最多显示 8 个汉字长度的文本
1.0.0
successfunction否
接口调用成功的回调函数
1.0.0
failfunction否
接口调用失败的回调函数
1.0.0
completefunction否
接口调用结束的回调函数(调用成功、失败都会执行)
1.0.0

回调成功

object 类型,属性如下:

属性名类型说明最低支持版本
errMsgstring
"showLoading:ok"
1.0.0

回调失败

object 类型,属性如下:

属性名类型说明最低支持版本
errMsgstring
"showLoading:fail" + 详细错误信息
1.0.0

错误码

errorCodeerrMsgerrorType说明最低支持版本
146999showLoading:fail params.title should be string,showLoading:fail params.mask should be booleanD
参数校验错误
1.0.0
104299showToast:fail title is invalid,showLoading:fail title is invalid,showToast:fail params.duration should be number,showToast:fail params.image should be string,showToast:fail params.mask should be boolean,showToast:fail image is invalid,showToast:fail params.title should be stringD
参数校验错误
1.0.0

扫码体验

请使用字节宿主APP扫码

代码示例