mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-30 03:38:54 +01:00
chore(Button): inject NuxtLink in components
This commit is contained in:
@@ -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'
|
||||||
|
|||||||
Reference in New Issue
Block a user