返回 slidev
LinkInline.vue
根目录 / docs / .vitepress / theme / components / LinkInline.vue
1 <script setup lang="ts">
2 import { Tooltip } from 'floating-vue'
3 import { withBase } from 'vitepress'
4 import { computed } from 'vue'
5 import { resolveLink } from '../../utils'
6
7 const props = defineProps<{
8 link: string
9 }>()
10
11 const resolved = computed(() => resolveLink(props.link))
12 </script>
13
14 <template>
15 <span class="sr-only">{{ resolved.title }}</span>
16 <ClientOnly>
17 <Tooltip class="inline-block" theme="twoslash">
18 <a
19 :href="withBase(resolved.url)"
20 target="_blank"
21 class="bg-$vp-c-default-soft hover:bg-$vp-c-brand-soft rounded px2 py1 !decoration-none"
22 >
23 {{ resolved.title }}
24 </a>
25
26 <template #popper>
27 <a
28 :href="withBase(resolved.url)"
29 target="_blank"
30 flex flex-col p4 gap-2 max-w-100
31 >
32 <div flex gap-2>
33 <div>
34 {{ resolved.title }}
35 </div>
36 <div flex-grow />
37 <FeatureTag v-for="tag in resolved.tags" :key="tag" :tag :noclick="resolved.kind !== 'features'" text-xs />
38 </div>
39 <div op75 text-sm>
40 {{ resolved.descripton }}
41 </div>
42 </a>
43 </template>
44 </Tooltip>
45 </ClientOnly>
46 </template>
47
47 lines Plain Text