fix: 制御キーの場合を個別ハンドリングするのではなくブラウザ既定の挙動に任せるように
This commit is contained in:
parent
63b7beb73b
commit
d044217b98
|
@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<a ref="el" :href="to" :class="active ? activeClass : null" @click.prevent="nav" @contextmenu.prevent.stop="onContextmenu">
|
||||
<a ref="el" :href="to" :class="active ? activeClass : null" @click="nav" @contextmenu.prevent.stop="onContextmenu">
|
||||
<slot></slot>
|
||||
</a>
|
||||
</template>
|
||||
|
@ -86,6 +86,11 @@ function openWindow() {
|
|||
}
|
||||
|
||||
function nav(ev: MouseEvent) {
|
||||
// 制御キーとの組み合わせは無視(shiftを除く)
|
||||
if (ev.metaKey || ev.altKey || ev.ctrlKey) return;
|
||||
|
||||
ev.preventDefault();
|
||||
|
||||
if (behavior === 'browser') {
|
||||
window.location.href = props.to;
|
||||
return;
|
||||
|
@ -99,11 +104,6 @@ function nav(ev: MouseEvent) {
|
|||
return openWindow();
|
||||
}
|
||||
|
||||
if (ev.ctrlKey) {
|
||||
window.open(props.to, '_blank', 'noopener');
|
||||
return;
|
||||
}
|
||||
|
||||
router.pushByPath(props.to, ev.ctrlKey ? 'forcePage' : null);
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue