zhengyiming
2 天以前 bd7dd96c732ded6854d47bf77f65e5c64d3d15e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { getPlatform } from './universal-api/index';
 
export const isPC = getPlatform() === 'pc';
 
export const isH5 = getPlatform() === 'h5';
 
export const isWeChat = getPlatform() === 'wechat';
 
export const isApp = getPlatform() === 'app';
 
// export const isUniFrameWork = typeof window.uni !== 'undefined';
 
// H5、小程序、app 均认为是手机端产品,如果需要统一手机端 UI 样式,可以直接用 isMobile 控制
export const isMobile = isH5 || isWeChat || isApp;
export const isWeb = isH5 || isPC;
 
export const isInAlipay = /AlipayClient/i.test(navigator?.userAgent);
export const isInWeChat = /MicroMessenger/i.test(navigator?.userAgent);