cocos creator 跳转其他小游戏
微信小游戏 appid 要填写在 game.json里才能跳转成功
"navigateToMiniProgramAppIdList": [
"appid0",
"appid1"
]
为icon添加按钮点击事件
//icon 被点击
onGameIconClick(e, cutomData) {
let appid = this.setAppid(cutomData);
if (typeof (wx) == "underfined") return;
wx.navigateToMiniProgram({
appId: appid,
path: '',
success(res) {
// 打开成功
}
})
},
本文介绍如何在CocosCreator中实现跳转至微信小游戏的功能。关键在于正确配置game.json文件,添加目标小游戏的appid至navigateToMiniProgramAppIdList列表,并为游戏图标设置按钮点击事件。通过调用wx.navigateToMiniProgram方法,可以实现从当前游戏跳转到指定的小游戏。
1118

被折叠的 条评论
为什么被折叠?



