The component in vuex cannot get the status value.

problem description

the component in vuex cannot get the status value

the environmental background of the problems and what methods you have tried

you can"t get

by using {{$store.state.certificationStatus}} directly in the page.

computed: {

        ...mapState([             //
            "certificationStatus"
          ])
    },

is also wrong

related codes

/ / Please paste the code text below (do not replace the code with pictures)
actions.js

    getCertificationStatus(context,vm){
    return new Promise((resolve, reject) => {
        axios.post("/realNameUtils/gotoStatusPage")
      .then((res)=>{
              context.commit("certificationStatus",res.data.content)  mutaitions
              

mutations.js

certificationStatus(state,data){
    state.certificationStatus = data
    console.log(state.certificationStatus)      
}                  

components

computed: {
        certificationStatus() {
            return this.$store.state.certificationStatus;
        }
    },
    mounted(){
        this.$nextTick(()=>{
            this.$store.dispatch("getCertificationStatus",this)
        });

what result do you expect? What is the error message actually seen?

expect to get the status value and you can manipulate the status value. What I need is to judge the status value and decide what to display according to the status value.
print result

Mar.28,2021

you can check in vue-devtools to see whether there is a value of certificationStatus in the corresponding state


has it been solved? I also encountered this problem

.
Menu