get the attributes in vuex in computed in the vue component, and then send the request using the properties in state in the created life hook. It is found that the parameters are not obtained when mounted sends the request, and the page is updated only after it is correct:
computed: {
...(mapState({
user_name: state => state.user_name,
user_id: state => state.user_id,
user_source: state => state.user_source,
}))
}
created() {
request(extend(true, {}, apis.getUserConsultInfo, {
params: {
consult_id: this.consult_id,
user_id: this.user_id,
user_source: this.user_source
}
})).then((res) => {
console.log(res);
}, (errmsg) => {
this.$message.error(errmsg);
});
}
how can this situation be broken? Ask the great god to solve ~