Loading

js根据ua判断常用设备

let ua = navigator.userAgent;
Vue.prototype.$isPC = !!!ua.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
Vue.prototype.$isIOS = /iPhone|iPad|iPod/i.test(ua);
Vue.prototype.$isAndroid = /Android/i.test(ua);
Vue.prototype.$isWX = /MicroMessenger/i.test(ua);
Vue.prototype.$isDingTalk = /DingTalk/i.test(ua);
Vue.prototype.$isWxMini = /MicroMessenger/i.test(ua) && /miniProgram/i.test(ua);
posted @ 2021-05-17 15:42  十年歧路  阅读(547)  评论(0编辑  收藏  举报