1. There is a v-for loop, output each object comment,comment uses the element card component to output each attribute value
2.comment has an attribute comsimghead to store the picture name, first use v-if to determine whether it is empty, if it is empty, img src= ".. / images/head/head.jpg", this is no problem, but not empty how to make src for ".. / images/head/" + comsimghead? (it"s too troublesome to implement all the conversions, and you can"t write variable values after converting to src=, and you have to declare variables in data.)
3. The code is as follows:
<el-col :span="12" v-for="comment in currentcomments" :key="comment.comid" :offset="1" style="margin-bottom:40px">
<el-card :body-style="{ padding: "0px", height:"200px"}" style="width: 800px;height: 200px;">
<div style="padding: 6px;height: 180px;">
<div style="height:50px;"><!---->
<div style="float: left;width: 50px;height: 50px;" v-if="comment.comsimghead ==null || comment.comsimghead ==""">
<img src="../images/head/head.jpg" style="height: 40px;width: 40px;border-radius: 20px;margin: 10px 0px 10px 10px;" />
</div>
<div style="float: left;width: 50px;height: 50px;" v-else><!--src-->
<img src="../images/head/" style="height: 40px;width: 40px;border-radius: 20px;margin: 10px 0px 10px 10px;" />
</div>
<div style="float: left;position:relative;top:20px;width:300px;height: 30px;"><font size="5">{{comment.comsname}}</font></div>
</div>
</div>
</el-card>
</el-col>