Appearance
用于进行评论列表的展示。
默认情况下,单个商品的评论的图片是按照单行滑动进行展示的。
<script lang="ts" setup> import { ref, onMounted } from 'vue' const cmt = ref({}) onMounted(() => { uni.request({ url: 'https://storage.360buyimg.com/nutui/3x/comment_data.json', success: function (res) { cmt.value = res.data.Comment } }) }) const handleclick = (info: any) => { console.log('进行跳转', info) } const clickImages = (imgs: any) => { console.log('进行图片展示', imgs) } </script> <template> <nut-comment :images="cmt.images" :videos="cmt.videos" :info="cmt.info" @click="handleclick" @clickImages="clickImages" :operation="['replay']" > <template #commentLabels> <image style="height:15px;width:50px" src="https://img11.360buyimg.com/imagetools/jfs/t1/211858/17/4258/12101/618e6f78Ed0edcadc/e83a673555edf59f.jpg" /> </template> </nut-comment> </template>
通过 headerType 的值可以设置图片多行展示。
<script lang="ts" setup> import { ref, onMounted } from 'vue' const cmt = ref({}) onMounted(() => { uni.request({ url: 'https://storage.360buyimg.com/nutui/3x/comment_data.json', success: function (res) { cmt.value = res.data.Comment } }) }) const clickImages = (imgs: any) => { console.log('进行图片展示', imgs) } </script> <template> <nut-comment headerType="complex" imagesRows="multi" :images="cmt.images" :videos="cmt.videos" :info="cmt.info" ellipsis="6" @clickImages="clickImages" > <template #commentLabels> <img class="nut-comment-header__labels--item" src="https://storage.360buyimg.com/imgtools/78925d9440-f9e874d0-e93d-11eb-8e5c-0da9e18a13b1.png" style="height: 12px" /> </template> <template #commentShopReply> <div class="nut-comment-shop"> <text style="display:inline-block">京东美妆国际:</text> 尊敬的客户您好,非常抱歉给您带来不愉快的购物体验,关于过敏,什么成分都不存在个别性和普遍性。 </div> </template> </nut-comment> </template>
<script lang="ts" setup> import { ref, onMounted } from 'vue' const cmt = ref({}) onMounted(() => { uni.request({ url: 'https://storage.360buyimg.com/nutui/3x/comment_data.json', success: function (res) { cmt.value = res.data.Comment } }) }) const clickImages = (imgs: any) => { console.log('进行图片展示', imgs) } </script> <template> <nut-comment imagesRows="multi" :images="cmt.images" :videos="cmt.videos" :info="cmt.info" :follow="cmt.follow" @clickImages="clickImages" /> </template>
default
complex
'default'
one
multi
'one'
false
[]
{}
['replay', 'like', 'more']
(val: object) => void
(val: string) => void
images 数组中存放的是图片对象。
const images = [{ smallImgUrl: '', // 小图,列表展示时使用 bigImgUrl: '', // 大图,大图展示使用 imgUrl: '', // 兜底图 }]
const videos = [{ mainUrl: '', // 视频遮罩图片 videoUrl: '', // 视频链接 }]
用于存放评论相关的信息。
const info = { content: '', // 评论详情 nickName: '', // 评论人的姓名 score: 5, // 评论星星数 avatar: '', // 评论人头像 time: '', // 评论时间 size: '', // 评论人购买的商品规格 replay: 23, // 此评论的回复数 like: 1, // 此评论的点赞数 }
用于存放追评相关的信息。
const follow = { days: 0, // 购买多少天后进行追评 content: '', // 追评内容 images: [] // 追评图片 }
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 ConfigProvider 组件。
Comment 商品评论
介绍
用于进行评论列表的展示。
评论图片单行展示
默认情况下,单个商品的评论的图片是按照单行滑动进行展示的。
评论图片多行展示
通过 headerType 的值可以设置图片多行展示。
追评展示
API
Props
default
/complex
'default'
one
/multi
'one'
false
[]
[]
{}
{}
['replay', 'like', 'more']
Events
(val: object) => void
(val: string) => void
(val: object) => void
Slots
images 数组
images 数组中存放的是图片对象。
videos 数组
info 对象
用于存放评论相关的信息。
follow 对象
用于存放追评相关的信息。
主题定制
样式变量
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 ConfigProvider 组件。