creator怎么设置微信转发

小程序里面有Page(),但是小游戏里面没有这个东西,下面代码要放在哪里呢?
creator怎么设置微信转发,以下代码放着哪里好呢。

onShareAppMessage: function (res) {
if (res.from === ‘button’) {
// 来自页面内转发按钮
console.log(res.target)
}
return {
title: ‘自定义转发标题’,
path: ‘/page/user?id=123’,
success: function (res) {
// 转发成功
},
fail: function (res) {
// 转发失败
}
}
},

直接判断如果是微信小游戏环境下,就可以调wx.onShareAppMessage啦
例如

    listenWXEvent() {
        var self = this
        wx.onShow(function(res) {
            if (res.scene) {
                if (res.scene == SCENE_SHARE_CARD) {
                   //todo                
                }
                else if (res.scene == SCENE_SUBSCRIPTION) {
                    //todo
                }
            }
        })
    },

我写了wx.onShareAppMessage函数,完全没作用啊,什么反应都没有,任何打印也没

wx.shareAppMessage({
title: ‘我要分享’,
success: function (res) {
console.log(‘拉起分享 成功’);
console.log(res);
},
fail: function (res) {
console.log(‘拉起分享 失败’);
console.log(res);
}
});

兄弟,你解决了吗?后面是如果搞的,右上角转发如果改转发配置的?

游戏启动的时候,调用wx.onShareAppMessage()这个接口,点击右上角的三个点,就有转发功能了。

在启动 场景 的onLoad /onStart 中 调用 wx.showContextMenu() ; wx.onShareAppMessage()…
这样用户从右上角就出现转发菜单项, 并且转发时,你也能在 onShareAppMessage中收到回调事件了.

你好 可以请教个问题吗 我现在测试转发 是到几个测试群0-8 然后怎么测试查看我转发之后 分享的页面被打开的页面