mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-27 06:01:08 +08:00
make dropdown item links middle clickable
This commit is contained in:
parent
8d120f2bb6
commit
227a3fbc28
@ -27,6 +27,21 @@ const type = computed(() => {
|
||||
return "p";
|
||||
}
|
||||
});
|
||||
|
||||
// we can't pass href as undefined, else links aren't middle clickable, so we gotta use this computed...
|
||||
const attrs = computed(() => {
|
||||
if (props.to) {
|
||||
return {
|
||||
to: props.to,
|
||||
};
|
||||
} else if (props.href) {
|
||||
return {
|
||||
href: props.href,
|
||||
};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -37,8 +52,7 @@ const type = computed(() => {
|
||||
'px-4 py-2 font-semibold hover:(bg-background-light-10 dark:bg-background-dark-90) ' +
|
||||
(disabled ? 'cursor-not-allowed text-opacity-50' : 'cursor-pointer')
|
||||
"
|
||||
:href="href"
|
||||
:to="to"
|
||||
v-bind="attrs"
|
||||
>
|
||||
<slot></slot>
|
||||
</component>
|
||||
|
Loading…
Reference in New Issue
Block a user