Skip to content

Instantly share code, notes, and snippets.

@hiamandeep
Last active May 8, 2020 15:44
Show Gist options
  • Select an option

  • Save hiamandeep/816f52b5b929464acc646d87d8c5d7e5 to your computer and use it in GitHub Desktop.

Select an option

Save hiamandeep/816f52b5b929464acc646d87d8c5d7e5 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
</head>
<body>
<div id="app">
<v-app>
<v-content>
<v-container>
<loader></loader>
</v-container>
</v-content>
</v-app>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
Vue.component('loader', {
data: function () {
return {
loading : false
}
},
methods:{
getRequest: function(){
this.loading = true;
axios.get('https://reqres.in/api/users?delay=2')
.then(response => {
this.loading = false;
console.log(response.data);
})
.catch(error => {
// handle error
console.log("This is error: " + error.response);
})
.finally(function () {
// always executed
});
}
},
template: `
<div>
<v-progress-circular
v-if="loading"
:size="50"
color="primary"
indeterminate
></v-progress-circular>
<v-btn @click="getRequest()">make get request</v-btn>
</div>
`
})
new Vue({
el: '#app',
vuetify: new Vuetify(),
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment