You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CampusVolunteer/admin/src/components/home/HomeComment.vue

108 lines
3.2 KiB

<template>
<div class="home-comment">
<!-- 标题 -->
<div class="title">用户留言</div>
<!-- 留言列表 -->
<div class="comment-list">
<!-- 循环渲染每个留言项 -->
<div v-for="(item, index) in list" :key="index" class="comment-item">
<!-- 用户头像和用户名 -->
<div class="user-content">
<el-image
class="avator"
:src="item.avator" // 设置头像图片源
></el-image>
<span class="user">{{ item.name }}</span> <!-- 显示用户名 -->
</div>
<!-- 留言内容 -->
<div class="comment">{{ item.content }}</div>
<!-- 创建时间 -->
<div class="create-time">{{ item.createTime }}</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
list: [
{
name: "MaskLin", // 用户名
avator:
"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg", // 头像图片
content:
"你以为只要长得漂亮就有男生喜欢?你以为只要有了钱漂亮妹子就自己贴上来了?你以为学霸就能找到好工作?我告诉你吧,这些都是真的!", // 留言内容
createTime: "5月02日 00:00" // 创建时间
},
{
name: "MaskLin",
avator:
"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
content: "作者太帅了",
createTime: "5月04日 00:00"
},
{
name: "MaskLin",
avator:
"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
content: "作者太帅了",
createTime: "5月04日 00:00"
},
{
name: "MaskLin",
avator: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
content: "作者太帅了",
createTime: "5月04日 00:00"
}
]
};
}
};
<style lang="scss" scoped>
.home-comment {
background: #ffffff; // 背景颜色
.title {
font-size: 18px; // 字体大小
color: #666; // 文字颜色
font-weight: bold; // 加粗
padding: 10px; // 内边距
border-bottom: 1px solid #eeeeee; // 下方边框
}
.comment-list {
padding: 10px; // 内边距
.comment-item {
padding: 10px; // 内边距
border-bottom: 1px solid #eeeeee; // 下方边框
.user-content {
display: flex; // 弹性布局
align-items: center; // 垂直居中
.user {
font-size: 18px; // 字体大小
color: #666; // 文字颜色
font-weight: bold; // 加粗
line-height: 50px; // 行高
margin-left: 10px; // 左侧外边距
}
.avator {
width: 50px; // 宽度
height: 50px; // 高度
border-radius: 50%; // 圆形
}
}
.comment {
margin-top: 10px; // 上方外边距
font-size: 14px; // 字体大小
color: #888888; // 文字颜色
}
.create-time {
margin-top: 15px; // 上方外边距
font-size: 14px; // 字体大小
color: #888888; // 文字颜色
}
}
}
}
</style>