关于vue.js:vue-使用computed报错-was-assigned-to-but-it-has-no-setter

问题:

 <a-radio @change="chooseOther" v-model="tempReadio">其余</a-radio>
 
 computed: {
    tempReadio() {
      if (this.reasonValue == 7) {
        return true;
      } else {
        return false;
      }
    },

此时就会报错

解决办法: 手动增加set 就好了

  computed: {
    tempReadio: {
      get() {
        if (this.reasonValue == 7) {
          return true;
        } else {
          return false;
        }
      },
      set(val) {},
    },
  },

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理