hookehuyr

✨ feat: 留言列表回复逻辑调整,新增一条需要删除一条保持长度

......@@ -43,7 +43,7 @@
</template>
</van-list>
<van-empty v-if="emptyStatus" class="custom-image" :image="no_image" description="暂无留言" />
<div style="height: 5rem;"></div>
<div style="height: 5rem;" />
<div class="reply-btn" @click="setComment('', 'comment')">
<div class="text">写下你友善的留言</div>
</div>
......@@ -270,6 +270,8 @@ const submitCommentBox = (note) => {
// 处理方法只能是插入相应的一条数据,这样就需要后台新增完成后,返回完整数据
_.each(commentList.value, comment => {
if (comment.id === commentId.value) {
// 后面新增一条,删除第一条,保存列表数量不变
comment.reply_list.shift()
comment.reply_list.push(res.data.data)
comment.total = comment.total + 1
}
......