fix(NcAppNavigation): fix native open link in a new tab
Signed-off-by: Grigorii Shartsev <grigorii.shartsev@nextcloud.com>
This commit is contained in:
Родитель
a432ff540c
Коммит
5c7756c58c
|
@ -642,13 +642,23 @@ export default {
|
|||
this.$emit('update:open', this.opened)
|
||||
},
|
||||
|
||||
// forward click event
|
||||
/**
|
||||
* Handle link click
|
||||
*
|
||||
* @param {PointerEvent} event - Native click event
|
||||
* @param {Function} [navigate] - VueRouter link's navigate if any
|
||||
* @param {string} [routerLinkHref] - VueRouter link's href
|
||||
*/
|
||||
onClick(event, navigate, routerLinkHref) {
|
||||
// Navigate is only defined if it is a router-link
|
||||
navigate?.(event)
|
||||
// Always forward native event
|
||||
this.$emit('click', event)
|
||||
// Prevent default link behaviour if it's a router-link
|
||||
// Do not navigate with control keys - it is opening in a new tab
|
||||
if (event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) {
|
||||
return
|
||||
}
|
||||
// Prevent default link behaviour if it's a router-link and navigate manually
|
||||
if (routerLinkHref) {
|
||||
navigate?.(event)
|
||||
event.preventDefault()
|
||||
}
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче