diff --git a/packages/vant-cli/site/desktop/router.js b/packages/vant-cli/site/desktop/router.js index 716451922..fd758e4e5 100644 --- a/packages/vant-cli/site/desktop/router.js +++ b/packages/vant-cli/site/desktop/router.js @@ -47,12 +47,12 @@ function getRoutes() { if (locales) { routes.push({ - path: '/*', + path: '/:catchAll(.*)', redirect: (route) => `/${getLangFromRoute(route)}/`, }); } else { routes.push({ - path: '/*', + path: '/:catchAll(.*)', redirect: '/', }); } diff --git a/packages/vant-cli/site/mobile/router.js b/packages/vant-cli/site/mobile/router.js index 0fadfb4b0..8bb18416b 100644 --- a/packages/vant-cli/site/mobile/router.js +++ b/packages/vant-cli/site/mobile/router.js @@ -28,7 +28,7 @@ function getRoutes() { if (langs.length) { routes.push({ - path: '/*', + path: '/:catchAll(.*)', redirect: (route) => `/${getLangFromRoute(route)}/`, }); @@ -41,7 +41,7 @@ function getRoutes() { }); } else { routes.push({ - path: '*', + path: '/:catchAll(.*)', redirect: () => '/', });