mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 11:17:41 +00:00
Docs: add English language support (#170)
* feat: support lang entry build * feat: vant support lang switch * move lang iframe-router to utils & fix router link bug * add en-US config && add some translation * chang async. to async_ (support superman cdn) * add layout translation * change nav style * upgrade zan-doc * fix: doc config * upgrade zan-doc && remove useless code * fix changelog generate path
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<h1 class="zanui-title">Zan UI</h1>
|
||||
<h2 class="zanui-desc">有赞移动端 Vue 组件库</h2>
|
||||
<div class="mobile-navs">
|
||||
<div class="mobile-nav-item" v-for="(item, index) in data" v-if="item.showInMobile" :key="index">
|
||||
<div class="mobile-nav-item" v-for="(item, index) in navList" v-if="item.showInMobile" :key="index">
|
||||
<mobile-nav v-for="(group, index) in item.groups" :group="group" :base="base" :nav-key="index" :key="index" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -13,17 +13,36 @@
|
||||
<script>
|
||||
import docConfig from '../doc.config';
|
||||
import MobileNav from './mobile-nav';
|
||||
import { getLang } from '../utils/lang';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
data: docConfig['zh-CN'].nav,
|
||||
base: '/component'
|
||||
docConfig,
|
||||
lang: getLang()
|
||||
};
|
||||
},
|
||||
|
||||
beforeRouteEnter(to, from, next) {
|
||||
next(vm => vm.lang = to.meta.lang);
|
||||
},
|
||||
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
this.lang = to.meta.lang;
|
||||
},
|
||||
|
||||
components: {
|
||||
MobileNav
|
||||
},
|
||||
|
||||
computed: {
|
||||
base() {
|
||||
return `${this.lang}/component`;
|
||||
},
|
||||
|
||||
navList() {
|
||||
return this.docConfig[this.lang].nav || [];
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@@ -17,7 +17,7 @@
|
||||
v-if="!navItem.disabled">
|
||||
<router-link
|
||||
active-class="active"
|
||||
:to="base + navItem.path">
|
||||
:to="'/' + base + navItem.path">
|
||||
<p>
|
||||
{{ navItem.title }}
|
||||
</p>
|
||||
|
Reference in New Issue
Block a user