极客飞人 2019-08-13 08:57 采纳率: 0%
浏览 1708

showTabBarReddot or setTabBarBadge无效没报错

最近开发个小程序,需要实现其它用户发送评论就在消息的tab那里显示个红点的功能,但是无论是调用showTabBarReddot还是setTabBarBadge,tabbar都没有任何反应,真不知道该如何解决┭┮﹏┭┮。下面发一下代码给大家看看。

qq

referComment: function (e){ 

    // 只能用缓存来传评论数据

    var criticism = wx.getStorageSync('criticism')

    var userInfo = wx.getStorageSync('userInfo')

    var commentCreatTime = utils.formatTime(new Date())

    var result = [userInfo.nickName, userInfo.avatarUrl, commentCreatTime, e.detail.value.comment, this.data.touristID, this.data.figureID, []]

    criticism.push(result)

    if(result[3]){

      this.refer(criticism, 'comment')

      news.add({

        data:{

          acceptor: this.data.creatorID,

          writer: [userInfo.nickName, userInfo.avatarUrl,this.data.touristID],

          content: [e.detail.value.comment, this.data.figureID],

          time: commentCreatTime,

          url: `/pages/details/details?id=${this.data.pageID}`,

          newsType:'消息回复',

          essayType: this.data.type

        }

      })   // 意思是用户提交了评论后,先判断是否为空评论,将评论信息写入数据库,然后在消息的tabbar那里显示红点

      wx.showTabBarRedDot({

        index: 1,

        success: res => { console.log(res) },

        fail: res => { console.error }

      })

} 
<form bindsubmit='referComment' report-submit='{{true}}'>

     <view class='form'>

      <textarea class='comment' name='comment' value='{{content}}' placeholder-style='color:#000;width:800rpx;z-index:-1' focus='{{focus}}' bindfocus="focusText"  bindblur="blurText">{{placeholder}}</textarea>

      <view class='uploadImages'>     

        <view class="addimages">

          <block wx:for='{{figures}}' wx:key="*this">

            <image src='{{figures[index]}}' style='margin:0 0 0 20rpx'></image>

          </block>

          <image bindtap='addimages' src="/images/plus-square-fill.png" style='width:50px;height:50px;margin-left: 20rpx;'></image>

          <image bindtap='delimages' src="/images/minus-square-fill.png" style='width:50px;height:50px'></image>

        </view>

      </view>

      <button form-type='submit' type='primary' wx:if='{{signIn}}' style='background-color:#8de7bb;width:90%;color: white;' bindtap='reddot'>发送</button>

    </view>

</form> 

  • 写回答

1条回答 默认 最新

  • dabocaiqq 2019-08-13 09:28
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器