Appearance
Comment 评论列表组件 — 基于 list-view 实现的层级评论展示组件,支持递归回复、点赞、用户点击等交互。
t-comment 是一个评论列表组件,内部使用 list-view 渲染,配合 t-comment-item 支持递归嵌套的子评论展示。适用于帖子详情、社交动态、任务评价等需要展示层级评论的场景。
t-comment
list-view
t-comment-item
<template> <t-comment :list="commentList" height="100%" empty-text="暂无评论" @reply="handleReply" @like="handleLike" /> </template> <script setup> const commentList = [ { id: 1, author: { name: '用户A', avatar: '/avatar/1.png' }, content: '这是一条评论', create_time: '2026-05-30 12:00:00', likes: 3, children: [ { id: 2, author: { name: '用户B', avatar: '/avatar/2.png' }, content: '这是回复', create_time: '2026-05-30 12:30:00', likes: 1, children: [] } ] } ] const handleReply = (e) => { console.log('回复:', e) } const handleLike = (e) => { console.log('点赞:', e) } </script>
{ item, index, replyItem, replyIndex }
{ user, item }
无内置插槽,子项通过 t-comment-item 组件递归渲染。
height
children
maxDepth
replyPageSize
authorBadgeText
t-comment
组件介绍
t-comment是一个评论列表组件,内部使用list-view渲染,配合t-comment-item支持递归嵌套的子评论展示。适用于帖子详情、社交动态、任务评价等需要展示层级评论的场景。基础用法
API
Props
Events
{ item, index, replyItem, replyIndex }{ item, index, replyItem, replyIndex }{ user, item }Slots
无内置插槽,子项通过
t-comment-item组件递归渲染。注意事项
height必须显式设置,list-view 需要明确高度children字段用于递归渲染子评论maxDepth控制递归深度,避免无限嵌套replyPageSize控制子评论按需展开的数量authorBadgeText配置,开启时会在对应评论上显示标识