From 8a4690a1d2d5d1c683cbd7d1dfd56d6dd3de6ce1 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Fri, 27 Nov 2020 16:12:15 +0800 Subject: [PATCH] fix(cli): incorrect route redirect config --- packages/vant-cli/site/desktop/router.js | 8 ++++++-- packages/vant-cli/site/mobile/router.js | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) 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({