Skip to content

Commit

Permalink
locale: fix fail to get navigator.languages on Meizu (#3412)
Browse files Browse the repository at this point in the history
魅族手机 navigator.languages 为空数组,拿不到系统语言,增加 && navigator.languages.length判断条件,可解决此bug
  • Loading branch information
wangqh authored and airyland committed Apr 8, 2019
1 parent d019836 commit 6fdcb35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugins/locale/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const locale = function (options = {}) {
return this.defaultLocal
}

return navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage)
return navigator.languages && navigator.languages.length ? navigator.languages[0] : (navigator.language || navigator.userLanguage)
},
set: function (locale) {
if (this.storageList.indexOf('cookie') > -1) {
Expand Down

0 comments on commit 6fdcb35

Please sign in to comment.