Skip to content

引入

ts
import { genSignature, getWxCfg } from 't-comm';

// 不支持 tree-shaking 的项目
import { genSignature, getWxCfg} from 't-comm/lib/wx/index';

// 只支持 ESM 的项目
import { genSignature, getWxCfg} from 't-comm/es/wx/index';

genSignature(ticket, url)

描述

获取jsAPI签名

校验地址:https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=jsapisign

文档地址:https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html

参数

参数名类型描述
ticketstring

票据

urlstring

当前url,不包括#之后的部分

返回:

signature

getWxCfg(apiList, openTagList)

描述

请求微信鉴权接口

参数

参数名类型描述
apiList*

api列表

openTagList*

openTag列表

返回: Promise

微信鉴权结果