Vuex asynchronously requests data in actions, obtains the data and submits it to mutations, before the component acquires it to data.

problem description

vuex asynchronously requests data in actions, and the obtained data is submitted to mutations, when the component acquires it to data.

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

actions
this.$nextTick  data   

related codes

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

        
  getCertificationStatus({context,state},vm){
    return new Promise((resolve, reject) => {
        axios.post("/realNameUtils/gotoStatusPage")
      .then((res)=>{
              content.commit("certificationStatus",res.data.content)
        if(res.data.content == "NOT_REALNAME"){
            vm.$router.push({path:"/user/info"})//
          }

mutations

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

components

    data(){
        return {
            type : "",//
            exampleDialogPerson : false,//
            exampleDialogLeagel: false,//
            exampleDialog2 : false,//
            exampleDialog3 : false,//
            show:false,//
            flag1:false,//
            flag2:false,
            flag3:false,
            flag4:false,
            phone: "",//
            typeMethods: "",//    
            stateRoute: "",//
            baazar: false,//
            certificationStatus1: ""
        }
    },
    components: {
        NavBar,
        PubFooter
    },
    computed: {
        certificationStatus(state) {
            return this.$store.state.certificationStatus;
        }
    },
    mounted(){
        this.$nextTick(()=>{
            this.certificationStatus1 = this.$store.state.certificationStatus;
        });
        console.log(this.certificationStatus)
        console.log(this.certificationStatus1)

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

I want to get the state value, operate the state value, judge the state value, and decide what to display according to the state value

Mar.28,2021

bind certificationStatus into computed.

computed: {
    certificationStatus() {
        return this.$store.state.certificationStatus
    }
}
watch: {
    certificationStatus(newVal) {
        if(newVal) {
            // 
        }
    }
}
Menu