Commit 1235978ab23740dfb11e3de7ac26a7d10a4899dc

Authored by 无木
1 parent 9dd9fcd3

fix: `useRedo` called duplicate may cause exception

修复useRedo的不当调用可能导致异常的问题

fixed: #1121
CHANGELOG.zh_CN.md
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
14 - 修复部分封装组件在使用插槽时报错的问题 14 - 修复部分封装组件在使用插槽时报错的问题
15 - 修复`useECharts`的`theme`参数不起作用的问题 15 - 修复`useECharts`的`theme`参数不起作用的问题
16 - 修复`Token`失效时,按 F5 刷新页面可能会出现页面加载异常的问题 16 - 修复`Token`失效时,按 F5 刷新页面可能会出现页面加载异常的问题
  17 + - 修复`useRedo`的不当调用可能会导致重定向`path`异常的问题
17 18
18 ## 2.7.1(2021-08-16) 19 ## 2.7.1(2021-08-16)
19 20
src/hooks/web/usePage.ts
@@ -42,6 +42,10 @@ export const useRedo = (_router?: Router) => { @@ -42,6 +42,10 @@ export const useRedo = (_router?: Router) => {
42 const { query, params = {}, name, fullPath } = unref(currentRoute.value); 42 const { query, params = {}, name, fullPath } = unref(currentRoute.value);
43 function redo(): Promise<boolean> { 43 function redo(): Promise<boolean> {
44 return new Promise((resolve) => { 44 return new Promise((resolve) => {
  45 + if (name === REDIRECT_NAME) {
  46 + resolve(false);
  47 + return;
  48 + }
45 if (name && Object.keys(params).length > 0) { 49 if (name && Object.keys(params).length > 0) {
46 params['_redirect_type'] = 'name'; 50 params['_redirect_type'] = 'name';
47 params['path'] = String(name); 51 params['path'] = String(name);