chore: 增加判断是快应用环境的API函数
This commit is contained in:
@@ -1162,5 +1162,23 @@ export default {
|
|||||||
verifyMobile(mobile) {
|
verifyMobile(mobile) {
|
||||||
var parse = /^\d{11}$/.test(mobile);
|
var parse = /^\d{11}$/.test(mobile);
|
||||||
return parse;
|
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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user