Vuex - Computed property “name” was assigned to but it has no setter

后端 未结 4 1373
耶瑟儿~
耶瑟儿~ 2020-12-07 11:41

I have a component with some form validation. It is a multi step checkout form. The code below is for the first step. I\'d like to validate that the user entered some text,

4条回答
  •  情歌与酒
    2020-12-07 12:16

    I was facing exact same error

    Computed property "callRingtatus" was assigned to but it has no setter

    here is a sample code according to my scenario

    computed: {
    
    callRingtatus(){
                return this.$store.getters['chat/callState']===2
          }
    
    }
    

    I change the above code into the following way

    computed: {
    
    callRingtatus(){
           return this.$store.state.chat.callState===2
        }
    }
    
    

    fetch values from vuex store state instead of getters inside the computed hook

提交回复
热议问题