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 { 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': {