fix: navigate function add path conditions

This commit is contained in:
shuai
2024-03-26 11:28:56 +08:00
parent 571c2b1a19
commit 92eec140d7
+8 -1
View File
@@ -151,7 +151,14 @@ const navigate = (to: string | number, config: NavigateConfig = {}) => {
}
window.location.replace(to);
} else if (typeof handler === 'function') {
handler(to === '/test' ? '/' : to, config.options);
if (to === '/test') {
to = '/';
}
if (to !== '/test' && to.startsWith('/test')) {
to = to.replace('/test', '');
}
handler(to, config.options);
}
}
if (typeof to === 'number' && typeof handler === 'function') {