快利用海内不反对一些接口,比方 service.share ,怎么在代码里判断并屏蔽,又不影响国内版本的应用呢?
解决办法:
能够先判断下以后快利用核心华为帐号的countryCode(如何获取详见:https://developer.huawei.com/...
app.ux代码片段如下:
data: { localeObject: '' }, test() { device.getServiceCountryCode({ success: function (ret) { this.localeObject = ret.serviceCountryCode console.log(ret.serviceCountryCode); }, fail: function (erromsg, errocode) { this.localeObject = 'errocode:' + errocode + ',erromsg:' + erromsg console.log(erromsg, errocode); }, complete: function () { } }) return this.localeObject }
页面ux中调用service.share:
fastAppShare() { if (this.$app.$def.test()==='CN') { share.share({ //此处为三方分享内容 }) } }
原文链接:https://developer.huawei.com/...
原作者:Mayism