[update] 判断移动端增加鸿蒙UA
This commit is contained in:
+1
-1
@@ -607,7 +607,7 @@ export function evil (fn) {
|
|||||||
export function isMobile () {
|
export function isMobile () {
|
||||||
const userAgentInfo = navigator.userAgent
|
const userAgentInfo = navigator.userAgent
|
||||||
|
|
||||||
const mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
|
const mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod', 'Harmony']
|
||||||
|
|
||||||
let mobileFlag = false
|
let mobileFlag = false
|
||||||
|
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ import { postAction, getAction } from '@/api/manage'
|
|||||||
|
|
||||||
import { getRSAPublicKey } from '@/utils/encryption.js'
|
import { getRSAPublicKey } from '@/utils/encryption.js'
|
||||||
import { JSEncrypt } from 'jsencrypt'
|
import { JSEncrypt } from 'jsencrypt'
|
||||||
|
import { isMobile } from '@/utils/util'
|
||||||
// const Base64 = require('js-base64').Base64
|
// const Base64 = require('js-base64').Base64
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -333,30 +334,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 判断当前设备
|
|
||||||
function isMobile () {
|
|
||||||
const userAgentInfo = navigator.userAgent
|
|
||||||
|
|
||||||
const mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
|
|
||||||
|
|
||||||
let mobileFlag = false
|
|
||||||
|
|
||||||
// 根据userAgent判断是否是手机
|
|
||||||
for (let v = 0; v < mobileAgents.length; v++) {
|
|
||||||
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
|
|
||||||
mobileFlag = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const screenWidth = window.screen.width
|
|
||||||
const screenHeight = window.screen.height
|
|
||||||
|
|
||||||
// 根据屏幕分辨率判断是否是手机
|
|
||||||
if (screenWidth < 500 && screenHeight < 800) {
|
|
||||||
mobileFlag = true
|
|
||||||
}
|
|
||||||
return mobileFlag
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user