diff --git a/package.json b/package.json index a65ee9094..b2927892c 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "vue": ">= 2.5.22" }, "devDependencies": { - "@vant/cli": "^2.0.0-beta.18", + "@vant/cli": "^2.0.0-beta.19", "vue": "^2.6.10", "vue-template-compiler": "^2.6.10" }, diff --git a/packages/vant-cli/site/desktop/components/Nav.vue b/packages/vant-cli/site/desktop/components/Nav.vue index 6e5481628..ebac7741f 100644 --- a/packages/vant-cli/site/desktop/components/Nav.vue +++ b/packages/vant-cli/site/desktop/components/Nav.vue @@ -32,11 +32,8 @@ export default { }, props: { - navConfig: Array, - base: { - type: String, - default: '' - } + lang: String, + navConfig: Array }, data() { @@ -52,6 +49,10 @@ export default { top: this.top + 'px', bottom: this.bottom + 'px' }; + }, + + base() { + return this.lang ? `/${this.lang}` : ''; } }, diff --git a/packages/vant-cli/site/desktop/components/NavLink.vue b/packages/vant-cli/site/desktop/components/NavLink.vue index f39355010..bc8157222 100644 --- a/packages/vant-cli/site/desktop/components/NavLink.vue +++ b/packages/vant-cli/site/desktop/components/NavLink.vue @@ -1,5 +1,5 @@ @@ -17,6 +17,23 @@ export default { itemName() { const name = (this.item.title || this.item.name).split(' '); return `${name[0]} ${name.slice(1).join(' ')}`; + }, + + path() { + const { path } = this.item; + return this.base ? `${this.base}/${path}` : path; + }, + + active() { + if (this.$route.path === this.path) { + return true; + } + + if (this.item.path === 'home') { + return this.$route.path === this.base; + } + + return false; } } }; diff --git a/packages/vant-cli/site/desktop/components/index.vue b/packages/vant-cli/site/desktop/components/index.vue index 0298df465..9767b1aaf 100644 --- a/packages/vant-cli/site/desktop/components/index.vue +++ b/packages/vant-cli/site/desktop/components/index.vue @@ -7,7 +7,7 @@ :lang-configs="langConfigs" @switch-version="$emit('switch-version', $event)" /> - + diff --git a/yarn.lock b/yarn.lock index de121dfd0..6fcc05bdb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1452,10 +1452,10 @@ lodash.unescape "4.0.1" semver "^6.3.0" -"@vant/cli@^2.0.0-beta.18": - version "2.0.0-beta.18" - resolved "https://registry.npm.taobao.org/@vant/cli/download/@vant/cli-2.0.0-beta.18.tgz#073cf13b44fcf772c510e0a142a627cb3049aa5b" - integrity sha1-BzzxO0T893LFEOChQqYnyzBJqls= +"@vant/cli@^2.0.0-beta.19": + version "2.0.0-beta.19" + resolved "https://registry.npm.taobao.org/@vant/cli/download/@vant/cli-2.0.0-beta.19.tgz#2e9ac47b3765221629f3adaf42a4ecb2e7e0ef1a" + integrity sha1-LprEezdlIhYp862vQqTssufg7xo= dependencies: "@babel/core" "^7.7.4" "@babel/plugin-proposal-optional-chaining" "^7.7.4"