Skip to content

Commit 38360ee

Browse files
authored
Merge pull request #95 from hecongyuan/master
修复hash路由无法跳转的问题
2 parents 5ef5ee6 + 0a4a9e0 commit 38360ee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils/is.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ export const isServer = typeof window === 'undefined'
9898
export const isClient = !isServer
9999

100100
export const isUrl = (path: string): boolean => {
101+
//修复路由匹配带hash路由#的地址无法跳转的问题
101102
const reg =
102-
/(((^https?:(?:\/\/)?)(?:[-:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&%@.\w_]*)#?(?:[\w]*))?)$/
103+
/(((^https?:(?:\/\/)?)(?:[-:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%#\/.\w-_]*)?\??(?:[-\+=&%@.\w_]*)#?(?:[\w]*))?)$/
103104
return reg.test(path)
104105
}
105106

0 commit comments

Comments
 (0)