chore(Button): inject NuxtLink in components

This commit is contained in:
Benjamin Canac
2023-05-22 19:05:39 +02:00
parent 524e220914
commit cb9ed9ad3f

View File

@@ -18,7 +18,7 @@
<script lang="ts"> <script lang="ts">
import { computed, defineComponent, useSlots } from 'vue' import { computed, defineComponent, useSlots } from 'vue'
import type { PropType } from 'vue' import type { PropType } from 'vue'
import type { RouteLocationNormalized, RouteLocationRaw } from 'vue-router' import type { RouteLocationRaw } from 'vue-router'
import { defu } from 'defu' import { defu } from 'defu'
import UIcon from '../elements/Icon.vue' import UIcon from '../elements/Icon.vue'
import { classNames } from '../../utils' import { classNames } from '../../utils'
@@ -32,7 +32,8 @@ import appConfig from '#build/app.config'
export default defineComponent({ export default defineComponent({
components: { components: {
UIcon UIcon,
NuxtLink
}, },
props: { props: {
type: { type: {
@@ -108,7 +109,7 @@ export default defineComponent({
default: false default: false
}, },
to: { to: {
type: [String, Object] as PropType<string | RouteLocationNormalized | RouteLocationRaw>, type: [String, Object] as PropType<string | RouteLocationRaw>,
default: null default: null
}, },
target: { target: {
@@ -142,7 +143,7 @@ export default defineComponent({
const buttonIs = computed(() => { const buttonIs = computed(() => {
if (props.to) { if (props.to) {
return NuxtLink return 'NuxtLink'
} }
return 'button' return 'button'