comment.vue 1.9 KB
<template>
	<!-- 评论 -->
	<view class="commentBox" v-for="item in commentList" :key="item.id">
		<view class="info flexA">
			<image :src="item.avatar" mode=""></image>
			<view class="name">
				<view>{{item.nickname}}</view>
				<text>{{item.createtime}}</text>
			</view>
		</view>
		<view class="openM">
			<open :text="item.content"></open>
		</view>
		<view class="imageBox">
			<image v-for="it in item.image" :src="it" mode=""></image>
		</view>
	</view>
</template>

<script setup>
	import {ref,reactive,onMounted} from 'vue'
	import open from './openComment.vue'
	let props = defineProps({
		commentList:{
			type:Array,
			default:[]
		}
	})
	onMounted(()=> {
		props.commentList.forEach(item=>{
			item.image = item.image.split(',')
		})
		// console.log('评论',props.commentList)
	})
	const shadowStyle = reactive({
					backgroundImage: "none",
					paddingTop: "0",
					marginTop: "0"
				})
	const content = ref('哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈')
</script>

<style lang="scss">
	.commentBox {
		.info {
			margin-bottom: 24rpx;
			
			image {
				width: 88rpx;
				height: 88rpx;
				border-radius: 50%;
				margin-right: 24rpx;
			}
			
			.name {
				:nth-child(1) {
					 color: #131a14d9;
					 font-size: 28rpx;
					 font-weight: 700;
					  line-height: 40rpx;
				}
				
				text {
					 color: #131a1466;
					 font-size: 24rpx;
					 margin-top: 4rpx;
				}
			}
		}
		
		.imageBox {
			margin-top: 32rpx;
			display: flex;
			flex-wrap: wrap;
			
			image {
				width: 226rpx;
				height: 226rpx;
				border-radius: 32rpx;
				margin: 0 12rpx 12rpx 0;
			}
			
			:nth-child(3n) {
				margin-right: 0 !important;
			}
		}
	}
</style>