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:
Yao
2017-10-06 12:33:28 +08:00
committed by GitHub
parent 265fcbf2ef
commit 64ec6ce5ac
68 changed files with 439 additions and 135 deletions
+20 -12
View File
@@ -1,6 +1,6 @@
<template>
<div class="app">
<zan-doc :simulator="simulator" :config="config">
<zan-doc :simulator="simulator" :config="config" :base="base">
<router-view></router-view>
</zan-doc>
</div>
@@ -8,28 +8,36 @@
<script>
import docConfig from './doc.config';
import { getLang } from './utils/lang';
export default {
data() {
if (location.host === 'www.youzanyun.com') {
if (window.location.host === 'www.youzanyun.com') {
const group = docConfig['zh-CN'].nav[0].groups[0];
group.list = group.list.filter(item => item.title !== '业务组件');
}
const hash = window.location.hash;
return {
simulator: this.getSimulatorPath(),
config: docConfig['zh-CN']
simulator: `/zanui/vue/examples${hash}`,
lang: getLang()
};
},
methods: {
getSimulatorPath() {
const dir = location.hash.split('/').pop();
if (dir === 'quickstart' || dir === 'changelog') {
return '/zanui/vue/examples';
} else {
return `/zanui/vue/examples#/component/${dir}`;
}
computed: {
base() {
return `/${this.lang}/component`;
},
config() {
return docConfig[this.lang];
}
},
watch: {
'$route'(to) {
this.lang = to.meta.lang;
}
}
};