docs: fix locales

This commit is contained in:
陈嘉涵 2019-12-16 14:21:30 +08:00
parent 1dd0d42b5f
commit 8641b8b256

View File

@ -3,11 +3,16 @@ import Locale from '../../src/locale';
import Lazyload from '../../src/lazyload'; import Lazyload from '../../src/lazyload';
import { get } from '../../src/utils'; import { get } from '../../src/utils';
import { camelize } from '../../src/utils/format/string'; import { camelize } from '../../src/utils/format/string';
import enUS from '../../src/locale/lang/en-US';
Vue.use(Lazyload, { Vue.use(Lazyload, {
lazyComponent: true lazyComponent: true
}); });
Locale.add({
'en-US': enUS
});
// helper for demo locales // helper for demo locales
Vue.mixin({ Vue.mixin({
computed: { 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 // add some basic locale messages
Locale.add({ Locale.add({
'zh-CN': { 'zh-CN': {