vue聊天功能模块(八)撤回消息实现
发布日期:2021-05-08 00:22:19 浏览次数:29 分类:精选文章

本文共 1873 字,大约阅读时间需要 6 分钟。

???????

??

  • ???????????????????
  • ??????????????????ID???ID?
  • ?????????????
    • ??????????????
    • ??????????
  • ??????????????????
  • ????????????
    • ????????????
    • ??????????????????????????????HTTP???

  • ??????????????????

  • ?????????v-for?????????
  • ?????????????@contextmenu.prevent?????rightMessageClick?
  • ?????
    rightMessageClick(msgId, uid) {  this.withdrawMessageSmgId = msgId;  if (uid === this.user.userId) {    this.setMsg(msgId);  } else {    return;  }}
  • ????????????
    handelBackEvent(e, msgId) {  let thisId = e.target.id;  switch (thisId) {    case 'delMsg':      this.delMsg(msgId);      break;    case 'withdrawMessage':      this.withdrawMessage(msgId);      break;    case 'cancelBack':      $('#backMsg').remove();      console.log('cancelBack');      break;  }}
  • ???????
    setMsg(num) {  $('#backMsg').remove();  const backMsgHtml = `    
    ??
    ??
    ??
    `; $('#msg' + num).append(backMsgHtml);}

  • ?????????

  • ?????
    let rspOBJ = DispatchmessageCtrl.backMsg(MsgIndex, TargetType, TargetInfo);
  • ???????
    if (rspOBJ === 0) {  // ??????  const htmld = `    

    ${msgInfo.una}???????

    `; $('#msg' + msgId).append(htmld); // ???? this.showMesDatas = this.showMesDatas.filter(item => item.mid !== msgId); this.withdrawMessageShow = false; $('#backMsg').remove();} else { // ???? this.withdrawMessageShow = false; this.$message.warning('????'); $('#backMsg').remove();}

  • ??????

    ????????

    • ??location.reload()??????????????

    ????????

    • ??showMesDatas????????
      this.showMesDatas = this.showMesDatas.map(item => {  if (item.mid === msgId) {    return { ...item, isBack: true };  }  return item;});

    ????

  • ???????????????
  • ??????????????????
  • ????????????????????????????
  • 上一篇:vue聊天功能模块(六)消息图片预览
    下一篇:vue分页功能

    发表评论

    最新留言

    做的很好,不错不错
    [***.243.131.199]2025年05月12日 01时55分20秒