组件
评论 Comment
Comment:评论组件。头像插槽放在左侧,正文上方显示 `author` 和 `datetime` 组成的署名,默认插槽放内容,actions 插槽放一排回复操作。
#基础用法
SW
The registry reads cleaner since the hairlines went in — the eye knows where one entry ends.
<script setup lang="ts">
import { Avatar, Button, Comment } from "@bysages/vue";
</script>
<template>
<Comment author="Sage Wei" datetime="Today, 09:12" class="w-full">
<template #avatar>
<Avatar.Root>
<Avatar.Fallback>SW</Avatar.Fallback>
</Avatar.Root>
</template>
The registry reads cleaner since the hairlines went in — the eye knows where one entry ends.
<template #actions>
<Button variant="ghost" size="sm">Reply</Button>
<Button variant="ghost" size="sm">Cite</Button>
</template>
</Comment>
</template>
AK
Filed. Shelved in the eastern cabinet, fourth row.
<script setup lang="ts">
import { Avatar, Comment } from "@bysages/vue";
</script>
<template>
<Comment author="Archive keeper" datetime="2026-09-15" class="w-full">
<template #avatar>
<Avatar.Root>
<Avatar.Fallback>AK</Avatar.Fallback>
</Avatar.Root>
</template>
Filed. Shelved in the eastern cabinet, fourth row.
</Comment>
</template>
SW
Shall the hairlines run through the annex as well?
AK
Yes — same rule, same weight, one page everywhere.
<script setup lang="ts">
import { Avatar, Comment } from "@bysages/vue";
</script>
<template>
<div class="grid gap-2 w-full">
<Comment author="Sage Wei" datetime="Today, 09:12">
<template #avatar>
<Avatar.Root>
<Avatar.Fallback>SW</Avatar.Fallback>
</Avatar.Root>
</template>
Shall the hairlines run through the annex as well?
</Comment>
<div class="ps-11">
<Comment author="Archive keeper" datetime="Today, 10:03">
<template #avatar>
<Avatar.Root>
<Avatar.Fallback>AK</Avatar.Fallback>
</Avatar.Root>
</template>
Yes — same rule, same weight, one page everywhere.
</Comment>
</div>
</div>
</template>
#属性
#Comment
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
author | String | undefined | — |
datetime | String | undefined | — |