乐趣区

关于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) {},},
  },
退出移动版