var api = require('../../../api/comment.js') const app = getApp() Page({ /** * 页面的初始数据 */ data: { replies: [], userName: '',//评论人昵称 userFace: '',//评论人头像 createdTime: '',//评论时间 content: '',//评论内容 likeCount: '',//点赞数 unLikeCount: ''//点踩数 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { wx.showLoading({ title: '加载中', }) this.getCommentReplyList(options) }, getCommentReplyList: function (options) { let that = this; api.getCommentReplyList(options).then(function (res) { wx.hideLoading() if (res.data != 'null' && res.data != null){ that.setData({ userName: res.data.userName,//评论人昵称 userFace: res.data.userFace,//评论人头像 createdTime: res.data.createdTime,//评论时间 content: res.data.content,//评论内容 likeCount: res.data.likeCount,//点赞数 unLikeCount: res.data.unLikeCount,//点踩数 replies: that.data.replies.concat(res.data.replies) }) } }) }, })