网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

使用uni-app怎么实现一个点赞评论功能

这期内容当中小编将会给大家带来有关使用uni-app怎么实现一个点赞评论功能,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

辽阳网站制作公司哪家好,找成都创新互联公司!从网页设计、网站建设、微信开发、APP开发、响应式网站等网站项目制作,到程序开发,运营维护。成都创新互联公司成立于2013年到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选成都创新互联公司

html


  {{item.timetype}}
  
  
    
  
  
  
    
  



  
  0">
    
    {{love.name}},
  
  
  0" v-for="(comment,comment_index) in item.community_on" :key="comment_index">
    {{comment.nickname}}: {{comment.content}}
  
   
  
    {{realtimename}}: {{realtimecontent}}
  
// 点赞
like(index,communityId) {
  if (this.community[index].islove == 0) {
    this.community[index].islove = 1;
    this.community[index].lovelist.push(
      {name:this.userinfo.nickname,vipid:this.userinfo.id}
    )
    this.likeImport(communityId)
  } else {
    this.community[index].islove = 0;
    this.community[index].lovelist.splice(this.community[index].lovelist.indexOf(this.userinfo.nickname), 1)
    this.likeImport(communityId)
  }
},
// 点赞接口
likeImport(id) {
  app.vipidRequest({
    url: 'Vip/community_love',
    data: {
      id: id
    },
    header: {
      'content-type': 'application/x-www-form-urlencoded', 
    },
    method: 'POST',
    success:(res) => {
      if(res.data.status) {

      } else {
        console.log(res.data)
      }
    }
  })
},
// 点击评论
comment(index,communityId) {
  this.showInput = true; //调起input框
  this.focus = true; // 对焦
  this.communityId = communityId
},
// 点击发送
send_comment: function(message) {
  this.commentStatus = true 
  this.commentIndex = index
  this.realtimecontent = message.content
  this.realtimename = this.userinfo.nickname
  app.vipidRequest({
    url: 'Vip/community_on',
    data: {
      id: this.communityId,
      content: message.content,
      type: 1
    },
    header: {
      'content-type': 'application/x-www-form-urlencoded', 
    },
    method: 'POST',
    success:(res) => {
      if(res.data.status) {
        this.getCommunity() // 整个页面数据刷新
        this.init_input()
        this.commentStatus = false // 临时渲染评论的列表隐藏
        this.realtimecontent = ''
        this.realtimename = ''
        this.input_placeholder = '评论';
      } else {
        console.log(res.data)
      }
    }
  })
}
// 取消评论/评论完成输入框状态值
init_input() {
  this.showInput = false;
  this.focus = false;
  this.input_placeholder = '评论';
  this.is_reply = false;
},

上述就是小编为大家分享的使用uni-app怎么实现一个点赞评论功能了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注创新互联行业资讯频道。


文章名称:使用uni-app怎么实现一个点赞评论功能
当前链接:http://bjjierui.cn/article/igsgdc.html

其他资讯