fix: useRedo called duplicate may cause exception

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

fixed: #1121
This commit is contained in:
无木 2021-08-24 20:59:08 +08:00
parent 9dd9fcd334
commit 1235978ab2
2 changed files with 5 additions and 0 deletions

View File

@ -14,6 +14,7 @@
- 修复部分封装组件在使用插槽时报错的问题
- 修复`useECharts`的`theme`参数不起作用的问题
- 修复`Token`失效时,按 F5 刷新页面可能会出现页面加载异常的问题
- 修复`useRedo`的不当调用可能会导致重定向`path`异常的问题
## 2.7.1(2021-08-16)

View File

@ -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);