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