hookehuyr

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

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