My component is like this :
...
You could add a loading div on your template, and toggle it's display based on loading
flag. Something like this
new Vue({
el: '#app',
data: {
show: true,
isLoading: false,
},
methods:{
loadData: function(){
this.isLoading = true;
setTimeout(function(){
this.isLoading = false;
}.bind(this),1000);
}
}
})
.loading{
display: none;
position: absolute;
width: 100%;
height: 100%;
top: 0;
background: rgba(128, 128, 128, 0.5);
}
.loading.show{
display: initial;
}
JS Bin
Loading
You could make the loading indicator pretty with css, or you can use already available one, for example you could use http://tobiasahlin.com/spinkit/, http://loading.io/