I have one data
variable in my app, It is message
, And also I have one method in methods which performs some cryptographic algorithms.
Here is my code.
export default {
data: () => ({
message: ""
}),
methods: {
click() {
this.message = "Hello";
console.log("this.message ", this.message); // Prints "Hello"
// takes around 8 seconds
var encryptedPassphrase = generateKeystore();
console.log("this.message ", this.message); // Prints "Hello"
}
}
};
Above message
variable I'm displaying in HTML tag, And method click
gets called from Vuetify button.
Below is HTML code,
<div>
<p>{{message}}</p>
<v-btn @click="click">Click</v-btn>
</div>
Issue
Now Problem is When click
method is called first task it does is updates message
variable, But this message
variable update reflects in HTML after the full function execution is completed. So In click
function next task is cryptographic computation which takes around 8 seconds, After this completes message
reflects in HTML. I have no idea what is going on here.
Just mentioning I'm using webpack
here.
Update
<v-btn @click="update(); click();">Click</v-btn>
Even this doesn't work, Here update
method updates message
variable, It updates after click
function is completed.