Currently, I am facing an issue with changing the value of a global variable dynamically from a function. The variable has a global scope and is also present in the same function as a local variable. However, despite my efforts, I am unable to successfully update the value of the global variable. I need guidance on how to ensure that changes made to the local variable also reflect in the global variable.
export default {
data() {
return {
status: false //global variable
};
},
methods: {
state(state) { //In this function, I receive either true or false as values
this.status = state.value; //Upon checking the console, I can see that the value updates locally but does not reflect globally
return status;
}
}