fix(breadcrumb): 修复面包屑跳转外链时,导致当前页面404问题 (#3337). close #3336
Co-authored-by: jackhoo_98 <jackhoo_98@foxmail.com>
| | |
| | | |
| | | import { useRouter } from 'vue-router'; |
| | | import { REDIRECT_NAME } from '@/router/constant'; |
| | | import { isHttpUrl } from '@/utils/is'; |
| | | import { openWindow } from '@/utils'; |
| | | |
| | | export type PathAsPageEnum<T> = T extends { path: string } ? T & { path: PageEnum } : T; |
| | | export type RouteLocationRawEx = PathAsPageEnum<RouteLocationRaw>; |
| | |
| | | if (!opt) { |
| | | return; |
| | | } |
| | | let path = unref(opt) as string; |
| | | if (path[0] === '/') { |
| | | path = path.slice(1); |
| | | } |
| | | if (isHttpUrl(path)) { |
| | | return openWindow(path); |
| | | } |
| | | isReplace ? replace(opt).catch(handleError) : push(opt).catch(handleError); |
| | | } |
| | | return go; |