From 8641b8b2563c634e502fc3887b9d604dd8b5cace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 16 Dec 2019 14:21:30 +0800 Subject: [PATCH] docs: fix locales --- docs/site/mobile.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/site/mobile.js b/docs/site/mobile.js index 33588259d..cda377ccc 100644 --- a/docs/site/mobile.js +++ b/docs/site/mobile.js @@ -3,11 +3,16 @@ import Locale from '../../src/locale'; import Lazyload from '../../src/lazyload'; import { get } from '../../src/utils'; import { camelize } from '../../src/utils/format/string'; +import enUS from '../../src/locale/lang/en-US'; Vue.use(Lazyload, { lazyComponent: true }); +Locale.add({ + 'en-US': enUS +}); + // helper for demo locales Vue.mixin({ computed: { @@ -40,6 +45,14 @@ Vue.mixin({ } }); +window.vueRouter.afterEach(to => { + const { lang } = (to.meta) || {}; + + if (lang) { + Locale.use(lang); + } +}); + // add some basic locale messages Locale.add({ 'zh-CN': {