My component is like this :
...
You simply need to attach it to a flag and use v-if
, if you're using vue resource, you can set the loading
flag to true in the before
callback and set it back to false
after you receive the response:
Vue Instance
methods: {
loadData() {
this.$http.get('/search', {
before: () => {
this.loading = true;
}
}).then(response => {
// Deal with response
}).then(() => {
//set loading flag to false
this.loading = false;
})
}
},
data: {
loading: false
}
HTML
Loading...
Here's the JSFiddle: https://jsfiddle.net/hyeycoan/