mirror of
https://github.com/youzan/vant.git
synced 2025-10-16 08:00:34 +00:00
feat(cli): set title by lang
This commit is contained in:
@@ -31,6 +31,17 @@ function parseName(name) {
|
||||
};
|
||||
}
|
||||
|
||||
function getLangFromRoute(route) {
|
||||
const lang = route.path.split('/')[1];
|
||||
const langs = Object.keys(locales);
|
||||
|
||||
if (langs.indexOf(lang) !== -1) {
|
||||
return lang;
|
||||
}
|
||||
|
||||
return getLang();
|
||||
}
|
||||
|
||||
function getRoutes() {
|
||||
const routes = [];
|
||||
const names = Object.keys(documents);
|
||||
@@ -38,7 +49,7 @@ function getRoutes() {
|
||||
if (locales) {
|
||||
routes.push({
|
||||
path: '*',
|
||||
redirect: `/${getLang()}/`
|
||||
redirect: route => `/${getLangFromRoute(route)}/`
|
||||
});
|
||||
} else {
|
||||
routes.push({
|
||||
|
Reference in New Issue
Block a user