写一个uni ui的评论展示界面
时间: 2023-02-22 10:47:37 浏览: 146
下面是一个简单的 Uni UI 评论展示界面的实现方式:
1. 创建一个 `<template>` 元素,用于放置评论内容;
2. 在 `<template>` 元素中添加一个循环,循环遍历评论列表;
3. 对于每个评论,创建一个 `<uni-card>` 元素,用于显示评论内容;
4. 在 `<uni-card>` 元素中,添加一个标题、评论内容、评论日期和用户头像;
5. 在页面中引入 `<template>` 元素,并使用评论列表数据渲染评论界面。
代码示例如下:
```
<template>
<view class="comment-list">
<view v-for="(item, index) in commentList" :key="index">
<uni-card>
<view slot="header">
<view class="user-info">
<image :src="item.avatar"></image>
<text class="username">{{ item.username }}</text>
</view>
<view class="comment-date">{{ item.date }}</view>
</view>
<view slot="content">
<text>{{ item.content }}</text>
</view>
</uni-card>
</view>
</view>
</template>
<script>
export default {
data() {
return {
commentList: [
{
username: '张三',
avatar: 'https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/shuijiao.jpg',
content: '这是一条评论内容',
date: '2022-01-01'
},
{
username: '李四',
avatar: 'https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/muwu.jpg',
content: '这是另一条评论内容',
date: '2022-02-01'
}
]
}
}
}
</script>
<style>
.comment-list {
padding: 20rpx;
阅读全文
相关推荐

















