codecamp

tt.onNavigateToMiniProgram

基础库 1.33.0 开始支持本方法,低版本需做兼容处理

监听跳转到其它游戏的事件。


参数

function callback

监听事件的回调函数。

callback 回调函数接收的对象属性

属性类型说明
errCodeNumber跳转结果状态码
errMsgString跳转结果信息
fromString跳转途径来源

errCode 取值说明

说明
0跳转成功
1跳转失败
2用户取消

from 取值说明

说明
showMoreGamesModaltt.showMoreGamesModal 显示的弹窗
createMoreGamesButtontt.createMoreGamesButton 更多游戏按钮打开的弹窗


示例

// 监听小游戏跳转
tt.onNavigateToMiniProgram(function(res) {
  console.log("open other games", res);
});
tt.showMoreGamesModal
tt.offNavigateToMiniProgram
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

无标题目录

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题目录

无标题文章

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }