mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(docs): [search] fix navigate error when enter pressed (#11718)
This commit is contained in:
@@ -72,19 +72,19 @@ function initialize(userOptions: any) {
|
||||
// }),
|
||||
|
||||
navigator: {
|
||||
navigate: ({ suggestionUrl }: { suggestionUrl: string }) => {
|
||||
navigate: ({ itemUrl }: { itemUrl: string }) => {
|
||||
if (!isClient) return
|
||||
|
||||
const { pathname: hitPathname } = new URL(
|
||||
window.location.origin + suggestionUrl
|
||||
window.location.origin + itemUrl
|
||||
)
|
||||
|
||||
// Router doesn't handle same-page navigation so we use the native
|
||||
// browser location API for anchor navigation
|
||||
if (route.path === hitPathname) {
|
||||
window.location.assign(window.location.origin + suggestionUrl)
|
||||
window.location.assign(window.location.origin + itemUrl)
|
||||
} else {
|
||||
router.go(suggestionUrl)
|
||||
router.go(itemUrl)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user