forked from Mirrors/elk
fix(ui): don't scroll on settings item click when external or _blank
target link (#2742)
This commit is contained in:
parent
59dda09cd4
commit
bead2183b2
1 changed files with 4 additions and 1 deletions
|
@ -10,9 +10,11 @@ const props = defineProps<{
|
||||||
external?: true
|
external?: true
|
||||||
large?: true
|
large?: true
|
||||||
match?: boolean
|
match?: boolean
|
||||||
|
target?: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const scrollOnClick = computed(() => props.to && !(props.target === '_blank' || props.external))
|
||||||
|
|
||||||
useCommand({
|
useCommand({
|
||||||
scope: 'Settings',
|
scope: 'Settings',
|
||||||
|
@ -39,11 +41,12 @@ useCommand({
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:to="to"
|
:to="to"
|
||||||
:external="external"
|
:external="external"
|
||||||
|
:target="target"
|
||||||
exact-active-class="text-primary"
|
exact-active-class="text-primary"
|
||||||
:class="disabled ? 'op25 pointer-events-none ' : match ? 'text-primary' : ''"
|
:class="disabled ? 'op25 pointer-events-none ' : match ? 'text-primary' : ''"
|
||||||
block w-full group focus:outline-none
|
block w-full group focus:outline-none
|
||||||
:tabindex="disabled ? -1 : null"
|
:tabindex="disabled ? -1 : null"
|
||||||
@click="to ? $scrollToTop() : undefined"
|
@click="scrollOnClick ? $scrollToTop() : undefined"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
w-full flex px5 py3 md:gap2 gap4 items-center
|
w-full flex px5 py3 md:gap2 gap4 items-center
|
||||||
|
|
Loading…
Reference in a new issue