37 lines
1.1 KiB
Vue
37 lines
1.1 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from "vue";
|
|
import { Card, CardTitle, CardDescription } from "@heroui-vue/components";
|
|
import { withBase } from "vitepress";
|
|
import { IconArrowUpRight } from "@tabler/icons-vue";
|
|
import { searchIndex } from "virtual:docs-data";
|
|
import { componentItems } from "./navigation";
|
|
const props = defineProps<{ category: string }>();
|
|
const items = computed(() =>
|
|
componentItems.filter((item) => item.category === props.category),
|
|
);
|
|
function description(url: string) {
|
|
return (
|
|
searchIndex.find((entry) => entry.url === url && entry.section === "概览")
|
|
?.text ?? "查看组件用法与 API"
|
|
);
|
|
}
|
|
</script>
|
|
<template>
|
|
<div class="components-grid not-prose">
|
|
<Card
|
|
v-for="item in items"
|
|
:key="item.url"
|
|
as="a"
|
|
:href="withBase(item.url)"
|
|
class="component-index-card"
|
|
variant="transparent"
|
|
>
|
|
<CardTitle>
|
|
{{ item.title }}
|
|
<IconArrowUpRight aria-hidden="true" :size="16" />
|
|
</CardTitle>
|
|
<CardDescription>{{ description(item.url) }}</CardDescription>
|
|
</Card>
|
|
</div>
|
|
</template>
|