In Vuex and View, how do you set a value or execute a function between ...mapActions(["getConfig"])
?
For example:
methods: {
this.theValue=true
...mapActions(["getConfig"])
this.theValue=false
}
Writing a response as a comment would be too short.
You need to call an action but also set up some value specific to your component. You need to wrap you action call such as
{
// ...
methods:{
...mapActions(["getConfig"]),
doGetConfig: async function(){
this.theValue = true;
await this.getConfig();
this.theValue = false;
}
}
}
You have to assume as all actions are asynchronous hence the async / await
.
getConfig
Un-related to your question but getConfig
sounds a getter name. I wrote the answer above assuming that it would be something like loadConfig