Created
June 3, 2017 16:37
-
-
Save tisuchi/47eb8acc0f07bba6e9c0a755b796dc72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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