w***@126.com
w***@126.com
  • 发布:2019-08-12 17:16
  • 更新:2019-08-13 09:44
  • 阅读:1073

#ifdef MP-QQ 不起作用

分类:HBuilderX

详细问题描述
请问
如何区分QQ小程序和微信小程序 在QQ小程序里面执行的是微信小程序的代码

重现步骤
[步骤]
[结果]
[期望]

运行环境
[系统版本]
[浏览器版本]
[IDE版本]
[mui版本]

附件
[代码片段]
[安装包]

联系方式
[QQ]
[电话]

2019-08-12 17:16 负责人:无 分享
已邀请:
DCloud_uniCloud_WYQ

DCloud_uniCloud_WYQ

我这边测试没问题,我看一下你的代码吧,还有你的HBuilderX的版本号是多少

w***@126.com

w***@126.com (作者)

// #ifdef MP-QQ  
            uni.login({  
                success: res => {  
                    // get code  
                    uni.request({  
                        url: this.apiBasic + '/qq/getOpenId',  
                        method: 'GET',  
                        data: {  
                            appid: this.qqAppid,  
                            secret: this.qqSecret,  
                            code: res.code  
                        },  
                        success: res => {  
                            // 存储openid  
                            this.openId = res.data.openid;  
                        },  
                        fail: () => {},  
                        complete: () => {}  
                    });  
                }  
            });  
            // #endif  

            // #ifdef MP-WEIXIN  
            uni.login({  
                success: res => {  
                    // get code  
                    uni.request({  
                        url: this.apiBasic + '/wechat/getOpenId',  
                        method: 'GET',  
                        data: {  
                            appid: this.wxAppid,  
                            secret: this.wxSecret,  
                            code: res.code  
                        },  
                        success: res => {  
                            // 存储openid  
                            this.openId = res.data.openid;  
                        },  
                        fail: () => {},  
                        complete: () => {}  
                    });  
                }  
            });  
            // #endif
w***@126.com

w***@126.com (作者)

在编辑器没有直接运行到QQ小程序的选项~

该问题目前已经被锁定, 无法添加新回复