[update] 判断移动端增加鸿蒙UA

This commit is contained in:
danshihao
2024-04-19 17:02:34 +08:00
parent d03fadfe8a
commit 785acaa00f
2 changed files with 2 additions and 25 deletions
+1 -1
View File
@@ -607,7 +607,7 @@ export function evil (fn) {
export function isMobile () {
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
+1 -24
View File
@@ -123,6 +123,7 @@ import { postAction, getAction } from '@/api/manage'
import { getRSAPublicKey } from '@/utils/encryption.js'
import { JSEncrypt } from 'jsencrypt'
import { isMobile } from '@/utils/util'
// const Base64 = require('js-base64').Base64
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>
<style lang="less" scoped>