JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
</head>
</html>
<body>
<div id="app">
<button v-on:click="myFunc">click !</button>
</div>
</body>
JavaScript
var app = new Vue({
el:'#app',
data(){
return{
a:null
}
},
methods:{
myFunc(){
new Promise(function(resolve,reject){
setTimeout(function(){
//
resolve();
},1000)
})
.then(function(){
this.a = 10;
});
console.log(this.a)
}
},
});