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
+31
View File
@@ -0,0 +1,31 @@
/**
* 同步父窗口和 iframe 的 vue-router 状态
*/
import isMobile from './is-mobile';
import { setLang } from './lang';
import { iframeReady } from './iframe';
window.syncPath = function(dir) {
const router = window.vueRouter;
const isInIframe = window !== window.top;
const currentDir = router.history.current.path;
const iframe = document.querySelector('iframe');
if (!isInIframe && !isMobile && iframe) {
iframeReady(iframe, () => {
iframe.contentWindow.changePath(currentDir);
});
}
};
window.changePath = function(path = '') {
const pathParts = path.split('/');
let lang = pathParts[0];
if (path[0] === '/') {
lang = pathParts[1];
}
setLang(lang);
window.vueRouter.replace(path);
};