当前位置: 首页 > news >正文

小程序API能力汇总——基础容器API(三)

ty.getAccountInfo

获取小程序账号信息

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

参数

Object object

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

object.success 回调参数

参数

Object res

属性类型说明
miniProgramMiniProgramAccountInfo小程序账号信息

MiniProgramAccountInfo

PropertyTypeDescription
appIdstring小程序 ID
envVersionstring小程序版本:
develop:开发版
trail:体验版
release:正式版
versionstring版本号

object.fail 回调参数

参数

Object res

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

函数定义示例

export type MiniProgramAccountInfo = {/** 小程序 ID */appId: string;/*** 小程序版本* develop: 开发版* trail: 体验版* release: 正式版*/envVersion: string;/** 小程序版本号 */version: string;
};
/*** 获取小程序账号信息*/
export function getAccountInfo(params?: {/** 接口调用结束的回调函数(调用成功、失败都会执行) */complete?: () => void;/** 接口调用成功的回调函数 */success?: (params: {/** 小程序账号信息 */miniProgram: MiniProgramAccountInfo;}) => void;/** 接口调用失败的回调函数 */fail?: (params: {errorMsg: string;errorCode: string | number;innerError: {errorCode: string | number;errorMsg: string;};}) => void;
}): void;

 

ty.getAccountInfoSync

获取小程序账号信息同步方法

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

getAccountInfo 的同步版本

返回值

属性类型说明
miniProgramMiniProgramAccountInfo小程序账号信息

MiniProgramAccountInfo

PropertyTypeDescription
appIdstring小程序 ID
envVersionstring小程序版本:
develop:开发版
trail:体验版
release:正式版
versionstring版本号

函数定义示例

export type MiniProgramAccountInfo = {/** 小程序 ID */appId: string;/*** 小程序版本* develop: 开发版* trail: 体验版* release: 正式版*/envVersion: string;/** 小程序版本号 */version: string;
};
/*** 获取小程序账号信息*/
export function getAccountInfoSync(): {/** 小程序账号信息 */miniProgram: MiniProgramAccountInfo;
};

 

ty.setBoardIcon

设置小程序看板的 icon

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

参数

Object object

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

函数定义示例

/*** 小程序看板的icon,小程序icon,面板icon等*/
export function setBoardIcon(params: {/** 看板的icon */icon: string;/** 接口调用结束的回调函数(调用成功、失败都会执行) */complete?: () => void;/** 接口调用成功的回调函数 */success?: (params: null) => void;/** 接口调用失败的回调函数 */fail?: (params: {errorMsg: string;errorCode: string | number;innerError: {errorCode: string | number;errorMsg: string;};}) => void;
}): void;

ty.setBoardIconSync

设置小程序看板的 icon

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

ty.setBoardIcon 的同步版本

参数

Object object

属性类型默认值必填说明
iconstring看板的 icon

函数定义示例

/*** 设置小程序看板的 icon*/
export function setBoardIconSync(params: {/** 看板的icon */icon: string;
}): null;

ty.showBoardTitleIcon

显示小程序看板中的标题和 icon

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

参数

Object object

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

函数定义示例

/*** 显示小程序看板中的标题和icon*/
export function showBoardTitleIcon(params?: {/** 接口调用结束的回调函数(调用成功、失败都会执行) */complete?: () => void;/** 接口调用成功的回调函数 */success?: (params: null) => void;/** 接口调用失败的回调函数 */fail?: (params: {errorMsg: string;errorCode: string | number;innerError: {errorCode: string | number;errorMsg: string;};}) => void;
}): void;

ty.showBoardTitleIconSync

The synchronous method used to display the title and icon of the miniapp dashboard.

Be sure to import MiniKit 3.0.3 or later.

The synchronous method of ty.showBoardTitleIcon.

Examples of function definitions

/*** Display the title and icon of the miniapp dashboard.*/
export function showBoardTitleIconSync(): null;

ty.hideBoardTitleIcon

隐藏小程序看板中的标题和 icon

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

参数

Object object

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

函数定义示例

/*** 隐藏小程序看板中的标题和icon*/
export function hideBoardTitleIcon(params?: {/** 接口调用结束的回调函数(调用成功、失败都会执行) */complete?: () => void;/** 接口调用成功的回调函数 */success?: (params: null) => void;/** 接口调用失败的回调函数 */fail?: (params: {errorMsg: string;errorCode: string | number;innerError: {errorCode: string | number;errorMsg: string;};}) => void;
}): void;

 

ty.hideBoardTitleIconSync

隐藏小程序看板中的标题和 icon 同步方法

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

ty.hideBoardTitleIcon 的同步版本

函数定义示例

/*** 隐藏小程序看板中的标题和icon*/
export function hideBoardTitleIconSync(): null;

👉 立即开发。 

http://www.lryc.cn/news/301994.html

相关文章:

  • 处理目标检测中的类别不均衡问题
  • (03)Hive的相关概念——分区表、分桶表
  • 2024年首发!高级界面控件Kendo UI全新发布2024 Q1
  • stable diffusion webui学习总结(2):技巧汇总
  • java 培训班预定管理系统Myeclipse开发mysql数据库web结构jsp编程servlet计算机网页项目
  • Python内置函数06——join
  • linux安装单机版redis详细步骤,及python连接redis案例
  • ts总结大全
  • 前端登录随机数字字母组合验证
  • 基于Java+SpringBoot+vue+elementui 实现即时通讯管理系统
  • 代码随想录算法训练营第50天(动态规划07 ● 70. 爬楼梯 (进阶) ● 322. 零钱兑换 ● 279.完全平方数
  • 【软考问题】-- 13 - 知识精讲 - 项目绩效域管理
  • VSCode无法连接远程服务器的两种解决方法
  • 【Kuiperinfer】笔记01 项目预览与环境配置
  • 都2024了,你还在使用websocket实现实时消息推送吗?
  • javaScript实现客户端直连华为云OBS实现文件上传、断点续传、断网重传
  • 微信小程序:实现微信小程序应用首页开发 (本地生活首页)
  • 【JavaScript】原型链和继承
  • (二)【Jmeter】专栏实战项目靶场drupal部署
  • 使用 ChatGPT系统学习一门知识的技巧
  • IDEA-常用插件
  • 揭秘:一行代码搞定.Net API高并发的烦恼
  • SpringBoot的 8 个优点
  • Spark中多分区写文件前可以不排序么
  • 突破编程_C++_面试(变量与常量)
  • k8s的一些关键信息(归类摘抄,非提炼)
  • 海外媒体发稿:8个提升影响力的日韩地区媒体发稿推广策略-华媒舍
  • 面试官:能不能给 Promise 增加取消功能和进度通知功能... 我:???
  • 详解MySQL增删查改
  • Mysql开启bin-log日志