fix(useRedo): 重新加载页面useRedo方法会添加一条浏览记录 (#2043)

This commit is contained in:
muamuamu 2022-07-07 15:41:08 +08:00 committed by GitHub
parent 35f2d074ae
commit 5833043d14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ export function useGo(_router?: Router) {
* @description: redo current page
*/
export const useRedo = (_router?: Router) => {
const { push, currentRoute } = _router || useRouter();
const { replace, currentRoute } = _router || useRouter();
const { query, params = {}, name, fullPath } = unref(currentRoute.value);
function redo(): Promise<boolean> {
return new Promise((resolve) => {
@ -46,7 +46,7 @@ export const useRedo = (_router?: Router) => {
params['_redirect_type'] = 'path';
params['path'] = fullPath;
}
push({ name: REDIRECT_NAME, params, query }).then(() => resolve(true));
replace({ name: REDIRECT_NAME, params, query }).then(() => resolve(true));
});
}
return redo;