浏览器的分类
获取浏览器的类型
const MobileMatches: ReadonlyArray<string> = [ 'Needle', 'Android', 'Symbian', 'UCWEB', 'iPhone', 'iPad', 'iPod', 'BlackBerry', 'Windows Phone', ] export default { isMobile() { let isMobile = false const ua = window.navigator.userAgent MobileMatches.forEach(name => { !isMobile && (isMobile = !!ua.match(new RegExp(`${name}`, 'i'))) }) return isMobile }, isEBai() { const EBaiAppReg = /AliApp(EB// return EBaiAppReg.test(window.navigator.userAgent) }, } const MobileMatches: ReadonlyArray<string> = [ 'Needle', 'Android', 'Symbian', 'UCWEB', 'iPhone', 'iPad', 'iPod', 'BlackBerry', 'Windows Phone', ] export default { isMobile() { let isMobile = false const ua = window.navigator.userAgent MobileMatches.forEach(name => { !isMobile && (isMobile = !!ua.match(new RegExp(`${name}`, 'i'))) }) return isMobile }, isEBai() { const EBaiAppReg = /AliApp(EB// return EBaiAppReg.test(window.navigator.userAgent) }, }