mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 05:42:44 +08:00
docs: fix missing demo locale (#9255)
This commit is contained in:
parent
a6b34d24b0
commit
f0f2059d91
2
.gitignore
vendored
2
.gitignore
vendored
@ -16,5 +16,5 @@ es
|
||||
lib
|
||||
dist
|
||||
vetur
|
||||
site
|
||||
./site
|
||||
changelog.generated.md
|
||||
|
@ -1,12 +1,13 @@
|
||||
import Locale from '../../src/locale';
|
||||
import enUS from '../../src/locale/lang/en-US';
|
||||
|
||||
Locale.add({
|
||||
export function initDemoLocale() {
|
||||
Locale.add({
|
||||
'en-US': enUS,
|
||||
});
|
||||
});
|
||||
|
||||
// switch lang after routing
|
||||
if (window.vueRouter) {
|
||||
// switch lang after routing
|
||||
if (window.vueRouter) {
|
||||
window.vueRouter.afterEach((to) => {
|
||||
const { lang } = to.meta || {};
|
||||
|
||||
@ -14,10 +15,10 @@ if (window.vueRouter) {
|
||||
Locale.use(lang);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// add some basic locale messages
|
||||
Locale.add({
|
||||
// add some basic locale messages
|
||||
Locale.add({
|
||||
'zh-CN': {
|
||||
add: '增加',
|
||||
decrease: '减少',
|
||||
@ -74,4 +75,5 @@ Locale.add({
|
||||
usernamePlaceholder: 'Username',
|
||||
passwordPlaceholder: 'Password',
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
import './demo-locale';
|
||||
import { initDemoLocale } from './demo-locale';
|
||||
import Lazyload from '../../src/lazyload';
|
||||
|
||||
initDemoLocale();
|
||||
|
||||
const { app } = window;
|
||||
if (app) {
|
||||
app.use(Lazyload, {
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { h, defineComponent } from 'vue';
|
||||
import Locale from '../src/locale';
|
||||
import { mount, later } from '.';
|
||||
import '../docs/site/demo-locale';
|
||||
import { initDemoLocale } from '../docs/site/demo-locale';
|
||||
|
||||
initDemoLocale();
|
||||
|
||||
const EmptyComponent = defineComponent({
|
||||
inheritAttrs: false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user