투표 페이지에서 투표 수가 새로고침되지 않습니다++

1. 투표 버튼 클릭

 vote(id) {
      Toast.loading({
        duration: 0, // 持续展示 toast
        forbidClick: true,
        message: '加载中...',
      })
      logaddlog({ cartoonId: id }).then((res) => {
      if (res.code == 200) {
          const idx = this.list.findIndex((t) => t.id == id)
          const voteNum = this.list[idx].voteNum
          this.$set(this.list, idx, { ...this.list[idx], voteNum: voteNum + 1 })
          Toast.clear()
          this.$toast(res.msg)
        } else {
          Toast.clear()
          this.$toast(res.msg)
        }
      })
    },

Acho que você gosta

Origin blog.csdn.net/weixin_57905352/article/details/125272123
Recomendado
Clasificación