This commit is contained in:
Your Name
2026-03-01 14:17:59 +08:00
parent 65aa12f146
commit a07e844c47
6071 changed files with 777651 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
<template>
<component :is="type" v-bind="linkProps">
<slot />
</component>
</template>
<script lang="ts" setup>
/**
* @description 兼容第三方页面的跳转
*/
import { isExternal } from '@/utils/validate'
interface Props {
to: string | Record<string, string>
replace?: boolean
}
const props = defineProps<Props>()
const isExternalLink = computed(() => {
return typeof props.to !== 'object' && isExternal(props.to)
})
const type = computed(() => {
if (isExternalLink.value) {
return 'a'
}
return 'router-link'
})
const linkProps = computed(() => {
if (isExternalLink.value) {
return {
href: props.to,
target: '_blank'
}
}
return props
})
</script>