Commit afacf688250ed11466d809e3f5d43d71ef81306b

Authored by Kyun Wong
Committed by GitHub
1 parent 60a3b6a9

fix: 解决重定向路径 params 参数丢失问题 (#2753)

Co-authored-by: kelvin <kyun.wang@jodoinc.com>
src/hooks/web/usePage.ts
... ... @@ -40,6 +40,7 @@ export const useRedo = (_router?: Router) =&gt; {
40 40 return;
41 41 }
42 42 if (name && Object.keys(params).length > 0) {
  43 + params['_origin_params'] = JSON.stringify(params ?? {});
43 44 params['_redirect_type'] = 'name';
44 45 params['path'] = String(name);
45 46 } else {
... ...
src/router/routes/basic.ts
... ... @@ -42,7 +42,7 @@ export const REDIRECT_ROUTE: AppRouteRecordRaw = {
42 42 },
43 43 children: [
44 44 {
45   - path: '/redirect/:path(.*)',
  45 + path: '/redirect/:path(.*)/:_redirect_type(.*)/:_origin_params(.*)',
46 46 name: REDIRECT_NAME,
47 47 component: () => import('/@/views/sys/redirect/index.vue'),
48 48 meta: {
... ...
src/views/sys/redirect/index.vue
... ... @@ -19,7 +19,7 @@
19 19 replace({
20 20 name: _path,
21 21 query,
22   - params,
  22 + params: JSON.parse((params._origin_params as string) ?? '{}'),
23 23 });
24 24 } else {
25 25 replace({
... ...