可以通过快应用的device.getInfo(OBJECT)接口返回的engineProvider判断,该字段代表快应用引擎的提供商,华为手机上会返回”huawei”。 文档链接: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 } }) }, |