Skip to content

Commit

Permalink
fix: useRedo called duplicate may cause exception
Browse files Browse the repository at this point in the history
修复useRedo的不当调用可能导致异常的问题

fixed: #1121
  • Loading branch information
mynetfan committed Aug 24, 2021
1 parent 9dd9fcd commit 1235978
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- 修复部分封装组件在使用插槽时报错的问题
- 修复`useECharts``theme`参数不起作用的问题
- 修复`Token`失效时,按 F5 刷新页面可能会出现页面加载异常的问题
- 修复`useRedo`的不当调用可能会导致重定向`path`异常的问题

## 2.7.1(2021-08-16)

Expand Down
4 changes: 4 additions & 0 deletions src/hooks/web/usePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export const useRedo = (_router?: Router) => {
const { query, params = {}, name, fullPath } = unref(currentRoute.value);
function redo(): Promise<boolean> {
return new Promise((resolve) => {
if (name === REDIRECT_NAME) {
resolve(false);
return;
}
if (name && Object.keys(params).length > 0) {
params['_redirect_type'] = 'name';
params['path'] = String(name);
Expand Down

0 comments on commit 1235978

Please sign in to comment.