效果图

先展示代码js逻辑有详细注释
代码格式有点乱复制粘贴格式化即可
wxml
<view class="container">
<view class="total">共{
{comment_list.length + comment_list2.length}}条评论</view>
<input confirm-type="send" class="container_inp" value="{
{value}}" placeholder="{
{ placeholder2 }}" placeholder-class="container_place" bindconfirm="bindconfirm"></input>
<view class="container-item" wx:for="{
{comment_list}}" wx:for-item="list" wx:key="key">
<image class="item_img" src="{
{list.comment_user_avatar}}"></image>
<view class="item_right">
<view class="right_name">{
{list.comment_user_name}}</view>
<view class="right_content">
<text class="right_content_txt" bindtap='replyComment' data-type="1" data-name='{
{list.comment_user_name}}' data-cid='{
{list.comment_id}}' data-pid="{
{list.parent_id}}">{
{list.comment_text}}</text>
<text class="right_content_txt2">{
{list.comment_time}}</text>
<view class="reply" wx:for="{
{comment_list2}}" wx:for-item="list2" wx:key="list2" wx:if="{
{list2.parent_id == list.comment_id}}">
<image class="reply_img" src="{
{list2.comment_user_avatar}}"></image>
<view class="reply_right">
<view class="right_name">{
{list2.comment_user_name}}</view>
<text wx:if="{
{list2.reply_name == ''}}" class="right_content_txt" bindtap='replyComment' data-type="2" data-name='{
{list2.comment_user_name}}' data-cid='{
{list2.comment_id}}' data-pid="{
{list2.parent_id}}">{
{list2.comment_text}}</text>
<text wx:if="{
{list2.reply_name != ''}}" bindtap='replyComment' data-type="2" data-name='{
{list2.comment_user_name}}' data-cid='{
{list2.comment_id}}' data-pid