tt.onNavigateToMiniGameBox
基础库 1.67.0 开始支持本方法,低版本需做兼容处理。
监听跳转到小游戏盒子的事件。
语法
tt.onNavigateToMiniGameBox(callback);
参数说明
callback
类型 | 默认值 | 必填 | 说明 |
---|---|---|---|
Function | 是 | 回调函数 |
callback 参数
属性 | 类型 | 说明 |
---|---|---|
errCode | Number | 跳转结果状态码 |
errMsg | String | 跳转结果信息 |
errCode 取值说明
值 | 说明 |
---|---|
0 | 跳转成功 |
1 | 跳转失败 |
2 | 用户取消 |
返回值
无
代码示例
// 创建更多游戏按钮
const buttonWithImage = tt.createMoreGamesButton({
type: "image",
image: "images/more_games_btn.png",
style: {
left: 20,
top: 40,
width: 150,
height: 40,
lineHeight: 40,
backgroundColor: "#ff0000",
textColor: "#ffffff",
textAlign: "center",
fontSize: 16,
borderRadius: 4,
borderWidth: 1,
borderColor: "#ff0000",
},
actionType: "box",
appLaunchOptions: [
{
appId: "ttXXXXXX",
query: "foo=bar&baz=qux",
extraData: {},
},
// {...}
],
// 可以作为属性传入添加监听
onNavigateToMiniGameBox(res) {
console.log("跳转到小游戏盒子", res);
},
});
// 监听小游戏跳转
tt.onNavigateToMiniGameBox(function (res) {
console.log("跳转到小游戏盒子", res);
});
Bug & Tip
无
点击纠错
该文档是否对你的开发有所帮助?
有帮助
没帮助
该文档是否对你的开发有所帮助?
有帮助
没帮助