fix: 制御キーの場合を個別ハンドリングするのではなくブラウザ既定の挙動に任せるように

This commit is contained in:
kakkokari-gtyih 2025-08-24 19:24:52 +09:00
parent 63b7beb73b
commit d044217b98
1 changed files with 6 additions and 6 deletions

View File

@ -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>