diff --git a/packages/vant-cli/site/desktop/router.js b/packages/vant-cli/site/desktop/router.js index f0fa0ffce..7de932ac9 100644 --- a/packages/vant-cli/site/desktop/router.js +++ b/packages/vant-cli/site/desktop/router.js @@ -49,13 +49,17 @@ function getRoutes() { routes.push({ name: 'notFound', path: '/:path(.*)+', - redirect: (route) => `/${getLangFromRoute(route)}/`, + redirect: (route) => ({ + name: getLangFromRoute(route), + }), }); } else { routes.push({ name: 'notFound', path: '/:path(.*)+', - redirect: '/', + redirect: { + name: 'home', + }, }); } diff --git a/packages/vant-cli/site/mobile/router.js b/packages/vant-cli/site/mobile/router.js index 7d75d9e84..130d21e75 100644 --- a/packages/vant-cli/site/mobile/router.js +++ b/packages/vant-cli/site/mobile/router.js @@ -30,7 +30,9 @@ function getRoutes() { routes.push({ name: 'NotFound', path: '/:path(.*)+', - redirect: (route) => `/${getLangFromRoute(route)}/`, + redirect: (route) => ({ + name: getLangFromRoute(route), + }), }); langs.forEach((lang) => { @@ -45,7 +47,9 @@ function getRoutes() { routes.push({ name: 'NotFound', path: '/:path(.*)+', - redirect: () => '/', + redirect: { + name: 'home', + }, }); routes.push({