Skip to content

Commit 1c31f82

Browse files
committed
replace those IE11-incompatible API with ES5
1 parent 961cf2d commit 1c31f82

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lib/app/dataMixin.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,16 @@ export default {
4242
},
4343
$langConfig () {
4444
const { langs } = this.$site
45+
let targetLang
4546
let defaultLang
46-
const lang = (langs || []).find((lang, index) => {
47+
(langs || []).forEach((lang, index) => {
4748
if (lang.path === '/') {
4849
defaultLang = langs[index]
49-
} else {
50-
return this.$page.path.startsWith(lang.path)
50+
} else if (this.$page.path.indexOf(lang.path) === 0) {
51+
targetLang = langs[index]
5152
}
5253
})
53-
return lang || defaultLang
54+
return targetLang || defaultLang
5455
},
5556
$lang () {
5657
return this.$langConfig && this.$langConfig.lang || 'en'

lib/default-theme/NavLinks.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ import NavLink from './NavLink.vue'
2929
export default {
3030
components: { OutboundLink, NavLink, DropdownLink },
3131
computed: {
32-
userNav() {
32+
userNav () {
3333
if (Array.isArray(this.$site.themeConfig.nav)) {
3434
return this.$site.themeConfig.nav
3535
}
3636
return this.$site.themeConfig.nav[this.$basepath]
3737
},
38-
nav() {
38+
nav () {
3939
if (this.$site.langs && this.$site.langs.length) {
4040
let currentLink = this.$page.path
4141
const routes = this.$router.options.routes
@@ -51,7 +51,7 @@ export default {
5151
// Try to stay on the same page
5252
link = currentLink.replace(this.$langConfig.path, lang.path)
5353
// fallback to homepage
54-
if (!routes.find(route => route.path === link)) {
54+
if (!routes.some(route => route.path === link)) {
5555
link = lang.path
5656
}
5757
}

0 commit comments

Comments
 (0)