Comment 商品评论

参考 NutUI 的 comment 组件,支持对象驱动的评论详情、图片/视频、追评与操作栏。

展示评论信息,支持评论详情、图片/视频、追评与操作栏

演示

9:41

代码示例

<!-- 评论图片单行展示 -->
  <re-comment :info="commentData.info" :images="commentData.images" :operation="replyOnlyOperation" @click="handleCommentClick" @click-images="handleImagesClick" > <template #commentLabels> <view class="demo-label"> <text class="demo-label__text">品质好评</text> </view> </template> </re-comment>

<!-- 评论图片多行展示 -->
  <re-comment header-type="complex" images-rows="multi" :ellipsis="6" :info="commentData.info" :images="commentData.images" @click-operate="handleOperateClick" @click-images="handleImagesClick" > <template #commentLabels> <view class="demo-badge"> <text class="demo-badge__text">官方旗舰店</text> </view> </template> <template #commentShopReply> <text class="demo-reply__label">店铺回复:</text> <text class="demo-reply__text">您好,敏感肌建议先做局部试用;如有任何不适,请第一时间联系客服处理。</text> </template> </re-comment>

<!-- 追评展示 -->
  <re-comment :info="commentData.info" :images="commentData.images" :follow="commentData.follow" @click="handleCommentClick" @click-images="handleImagesClick" />

<!-- 兼容原有简化参数 -->
  <re-comment name="用户A" content="很好用,推荐购买。原有的 name、content、rate、reply 参数仍可继续使用。" :rate="5" date="2026-07-09" reply="感谢支持,我们会继续优化体验。" :images="simpleImageList" :liked="true" @click-operate="handleOperateClick" />

引入

推荐使用 easycom 模式,配置后无需手动 import 即可直接使用 <re-comment />。

API

Comment Props

名称类型默认值描述必传
avatarstring''-N
namestring''标识名称N
datestring''-N
ratenumber5-N
contentstring''内容文字N
imagesArray<string | CommentImage>() : Array<string | CommentImage> => as Array<string | CommentImage>-N
videosArray<CommentVideo>() : Array<CommentVideo> => as Array<CommentVideo>-N
replystring''-N
likedbooleanfalse-N
infoCommentInfo() : CommentInfo => ({-N
followCommentFollow--N
headerTypestring--N
imagesRowsstring--N
ellipsisstring | number | boolean--N
operationArray<string>--N
customStylestring-自定义样式N

Comment Events

名称参数描述
clickinfo: CommentInfo点击时触发
likeliked: boolean-
click-operateoperate: string-
click-imagesdetail: UTSJSONObject-

Comment Slots

名称描述
commentLabels-
feature-
commentShopReply-