chore: 增加判断是快应用环境的API函数

This commit is contained in:
2026-01-07 18:28:51 +08:00
parent 2d98a32efc
commit faf1f6d3d8

View File

@@ -1162,5 +1162,23 @@ export default {
verifyMobile(mobile) {
var parse = /^\d{11}$/.test(mobile);
return parse;
},
/**
* 判断是否为快应用环境
* @returns {boolean} 是否为快应用
*/
isQuickApp() {
const systemInfo = this.getDeviceInfo();
return systemInfo.platform === 'quickapp' || process.env.UNI_PLATFORM === 'quickapp';
},
/**
* 判断是否为华为快应用环境
* @returns {boolean} 是否为华为快应用
*/
isHuaweiQuickApp() {
if (!this.isQuickApp()) return false;
const systemInfo = this.getDeviceInfo();
return systemInfo.brand === 'HUAWEI' || systemInfo.manufacturer === 'HUAWEI' ||
(typeof qh !== 'undefined' && qh.platform === 'huawei');
}
}