You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
483 B
31 lines
483 B
<script setup>
|
|
import { RouterLink } from "vue-router"
|
|
import { computed } from "vue"
|
|
|
|
const props = defineProps({
|
|
...RouterLink.props,
|
|
url: {
|
|
type: String,
|
|
required: false,
|
|
default: null,
|
|
},
|
|
})
|
|
|
|
const isAnchor = computed(() => !!props.url)
|
|
</script>
|
|
|
|
<template>
|
|
<a
|
|
v-if="isAnchor"
|
|
:href="url !== '#' ? url : undefined"
|
|
v-bind="$attrs"
|
|
>
|
|
<slot />
|
|
</a>
|
|
<router-link
|
|
v-else
|
|
v-bind="props"
|
|
>
|
|
<slot />
|
|
</router-link>
|
|
</template>
|
|
|