creator cc.sys.platform判断登录渠道,微信,手Q,字节跳动的值是一样的,怎么解决?
自己设置一个判断值,[‘wx’,‘qq’,‘tt’]
125325871 能加个QQ请教一下吗?
就是简单的加一个platform = [‘wx’,‘qq’,‘tt’],在需要判断 的地方require一下写了platform的脚本,然后判断一下platform等于什么就行了,这个值我每次打包的时候都要改一下的platform[0]就是微信,打包微信的时候我要把这个值改成0
if(typeof tt != "undefined") {
console.log("这里是头条");
} else if(typeof qq != "undefined") {
console.log("这里是qq");
} else if(typeof wx != "undefined") {
console.log("这里是微信");
}
对,楼下那个办法很好,直接判断api存不存在
多谢大佬!!