微信小程序超过评论上限 关闭评论功能

有个字段jici 是保存帖子被回复了几次
在这里插入图片描述
在记录帖子的数据库表中加入触发器
在这里插入图片描述
在小程序中加入按钮button
这个页面在加载后需要request后台获取次数

其中disable是控制按钮能否使用 如果次数大于10 会将disable设置为true

<button bindtap="bindtest" data-jici="{{nr6.data[0].jici}}"  disabled="{{nengfoufatie}}" >{{jici}}66</button>

下面是小程序js

onLoad: function (options,e) {
      var id=options.Id;
      this.setData({id:id})
      var that=this;
    wx.request({
      url: 'https://www.fuhufuhu.com/dl',
      data: {
        tieziid:id,

      },
      method: 'post',
      header: {
        //'content-type': 'application/json' // 默认值
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
       // console.log(res.data[0].hfnr);
        //console.log(res.data[0].nr[0].jici);//要有0
        console.log(res.data);
        console.log("_________________________");
      //  console.log(res.data[0].hfnr.hfopenid);//要有0
        var jici=res.data.nr[0].jici;
        if(jici>=10){
          that.setData({jici:'超过数',  nengfoufatie:true//button disabled
          })
        }else{that.setData({jici:'fatie',nengfoufatie:false})}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值