Skip to content

Instantly share code, notes, and snippets.

@tisuchi
Created June 3, 2017 16:37
Show Gist options
  • Save tisuchi/47eb8acc0f07bba6e9c0a755b796dc72 to your computer and use it in GitHub Desktop.
Save tisuchi/47eb8acc0f07bba6e9c0a755b796dc72 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> VueJs transition for loading data - larademy.com</title>
</head>
<body>
<div id="app">
<i v-show="loading" class="fa fa-spinner fa-spin"></i>
</div>
<script src="https://unpkg.com/vue"></script>
<script>
new Vue({
el: '#app',
data: {
loading: false
},
ready: function() {
this.loading = true;
// GET request
this.$http({url: '/someUrl', method: 'GET'}).then(function (response) {
// success callback
this.loading = false;
}, function (response) {
// error callback
});
}
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment