可以通过快应用的device.getInfo(OBJECT)接口返回的engineProvider判断,该字段是华为拓展的(联盟快应用接口没有返回),代表快应用引擎的提供商,华为手机上会返回”huawei”。 device接口文档链接如下:https://developer.huawei.com/consumer/cn/doc/development/quickApp-References/quickapp-api-device#getInfo getDeviceInfo: function () {
var that = this
device.getInfo({
success: function (ret) {
that.deviceInfo = JSON.stringify(ret)
if (that.deviceInfo.indexOf('engineProvider') >= 0 && that.deviceInfo.indexOf('huawei') >= 0) {
that.isHuawei = true
} else {
that.isHuawei = false
}
},
fail: function (errorMsg, errorCode) {
that.deviceInfo = errorCode + ': ' + errorMsg
}})
},
|