/**
* 判断是否移动端
*/
export const isMobile = () => {
let sUserAgent = navigator.userAgent.toLowerCase();
let deviceTypeList = ['ipad', 'android', 'iphone', 'ipod'];
for (let i = 0; i < deviceTypeList.length; i++) {
if (sUserAgent.indexOf(deviceTypeList[i]) !== -1) {
return true;
}
}
return false;
};
const detectDeviceType = () =>
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent
) ? "Mobile" : "Desktop";
console.log(detectDeviceType());
07-11