ty.showStatusBar

显示手机状态栏

需引入MiniKit,且在>=2.6.0版本才可使用

参数

Object object

属性类型默认值必填说明
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数

函数定义示例

/**
 * 显示手机状态栏
 */
export function showStatusBar(params?: {
  complete?: () => void;
  success?: (params: null) => void;
  fail?: (params: {
    errorMsg: string;
    errorCode: string | number;
    innerError: {
      errorCode: string | number;
      errorMsg: string;
    };
  }) => void;
}): void;

ty.hideStatusBar

隐藏手机状态栏

需引入MiniKit,且在>=2.6.0版本才可使用

参数

Object object

属性类型默认值必填说明
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数

函数定义示例

/**
 * 隐藏手机状态栏
 */
export function hideStatusBar(params?: {
  complete?: () => void;
  success?: (params: null) => void;
  fail?: (params: {
    errorMsg: string;
    errorCode: string | number;
    innerError: {
      errorCode: string | number;
      errorMsg: string;
    };
  }) => void;
}): void;

 

ty.share

分享

需引入BizKit,且在>=3.0.0版本才可使用

参数

Object object

属性类型默认值必填说明
typestring分享渠道,可选值如下: WeChat:微信 Message:短信 Email:邮件 More:系统更多分享渠道(调用系统分享)
titlestringtitle 标题
messagestringmessage 文本内容
contentTypestringcontentType 内容类型 空值默认为 text 可选值如下: text:文本 image:图片 file:文件 web:网页地址 miniProgram:微信小程序分享内容
recipientsarrayrecipients 邮件收件人
imagePathstringimagePath 图片路径
filePathstringfilePath 当 contentType == file 时候使用
webPageUrlstringweb 当 contentType == file 时候使用
miniProgramInfoMiniProgramInfominiProgramInfo 当 contentType == miniProgram 时候使用,且分享渠道必须是微信。
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数

MiniProgramInfo

属性类型默认值必填说明
userNamestring用户名称
pathstring路径
hdImagePathstring图片地址
withShareTicketbooleanticket
miniProgramTypenumber类型
webPageUrlstring小程序地址

 

ty.getShareChannelList

获取可分享的渠道列表

需引入BizKit,且在>=3.0.0版本才可使用

参数

Object object

属性类型默认值必填说明
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数

object.success 回调参数

参数

Object res

属性类型说明
shareChannelListarray可分享的渠道列表

object.fail 回调参数

参数

Object res

属性类型说明
errorMsgstring插件错误信息
errorCodestring错误码
innerErrorobject插件外部依赖错误信息 {errorMsg: string, errorCode: string }

 

ty.getUserInfo

获取用户信息

需引入BizKit,且在>=3.0.0版本才可使用

参数

Object object

属性类型默认值必填说明
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数

object.success 回调参数

参数

Object res

属性类型说明
nickNamestringnickName 用户昵称
avatarUrlstring用户头像
phoneCodestring国家代码
isTemporaryUserboolean是否是临时用户

object.fail 回调参数

参数

Object res

属性类型说明
errorMsgstring插件错误信息
errorCodestring错误码
innerErrorobject插件外部依赖错误信息 {errorMsg: string, errorCode: string }

 

ty.openCountrySelectPage

进入选择国家页面

需引入BizKit,且在>=3.0.0版本才可使用

参数

Object object

属性类型默认值必填说明
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数

ty.onCountrySelectResult

国家列表界面选择的国家信息

需引入BizKit,且在>=3.0.0版本才可使用

参数

function callback

国家列表界面选择的国家信息的回调函数

回调参数 Object res

属性类型默认值必填说明
countryCodestring国家码
countryAbbstring国家编码
countryNamestring国家名称

 

ty.offCountrySelectResult

取消监听:国家列表界面选择的国家信息

需引入BizKit,且在>=3.0.0版本才可使用

参数

function callback

取消监听:国家列表界面选择的国家信息的回调函数

回调参数 Object res

属性类型默认值必填说明
countryCodestring国家码
countryAbbstring国家编码
countryNamestring国家名称

👉 立即开发。 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐