Skip to content

Commit

Permalink
fix: 解决 H5 在部分国产安卓内置浏览器报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhetengbiji committed May 31, 2019
1 parent 363c916 commit bfb96c7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/platforms/h5/service/api/device/get-system-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ export function getSystemInfoSync () {
}
} else if (isAndroid) {
osname = 'Android'
let osversionFind = ua.match(/Android\s([\w.]+);/)
// eslint-disable-next-line no-useless-escape
let osversionFind = ua.match(/Android[\s/]([\w\.]+)[;\s]/)
if (osversionFind) {
osversion = osversionFind[1]
}
let infos = ua.match(/\((.+?)\)/)[1].split(';')
const otherInfo = [/^\s?Android/i, /^\s?Linux/i, /^\s?U/i, /^\s?[a-z][a-z]$/i, /^\s?[a-z][a-z]-[a-z][a-z]$/i, /^\s?wv/i]
let infoFind = ua.match(/\((.+?)\)/)
let infos = infoFind ? infoFind[1].split(';') : ua.split(' ')
// eslint-disable-next-line no-useless-escape
const otherInfo = [/\bAndroid\b/i, /\bLinux\b/i, /\bU\b/i, /^\s?[a-z][a-z]$/i, /^\s?[a-z][a-z]-[a-z][a-z]$/i, /\bwv\b/i, /\/[\d\.,]+$/, /^\s?[\d\.,]+$/, /\bBrowser\b/i, /\bMobile\b/i]
for (let i = 0; i < infos.length; i++) {
const info = infos[i]
if (info.indexOf('Build') > 0) {
Expand Down

0 comments on commit bfb96c7

Please sign in to comment.