how the TotalComment, requested through get is assigned to totalComment in data
export default {
data() {
return {
contentId:1,
focusflag:true,
totalComment:TotalComment,
reply:"",
name:"",
articleContent:"",
active:"",
commentList:commentList,
goodCommentList:goodCommentList,
totalComment:TotalComment,
}
},
methods: {
//
getAllComment:function () {
Axios({
// `url` URL
url:devhttpUrl + "/content/comments/all?contentId="+1+"&pageNo=1&pageSize=20&totalItems=-1",
// `method`
method: "get", // get
headers: {"Authorization":"Bearer "+ token },
// data:postData
}).then(function (result) {
if(result.data.errCode==0){
var dataobj=result.data.data.items;
TotalComment=result.data.data.totalItems;
console.log(TotalComment)
for(var i=0;i<dataobj.length;iPP){
commentList.push({id:dataobj[i].id,name:dataobj[i].userNickName,time:dataobj[i].creationTime,replyNo:dataobj[i].replyCount,cool:dataobj[i].likeCount,content:dataobj[i].content})
}
}
else{
Toast(result.data.errMsg);
}
console.log(TotalComment)
//that.$set(that,"totalComment",TotalComment);
}).catch(function (error) {
console.log(error)
})
}