Last active
February 9, 2018 10:51
-
-
Save filipgorczynski/b0f3cb73529abfec37a906430e33d16b to your computer and use it in GitHub Desktop.
Default app.vue component
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
<template> | |
<div id="app"> | |
<h1>IMDb Top Rated Movies</h1> | |
<ul> | |
<li v-for="movie in movies"> | |
{{ movie.title }} <em>{{ movie.year }}</em> | |
</li> | |
</ul> | |
</div> | |
</template> | |
<script> | |
import axios from "axios"; | |
export default { | |
name: "App", | |
data: function() { | |
return { | |
movies: [] | |
}; | |
}, | |
created() { | |
axios | |
.get(process.env.API_URL) | |
.then(results => { | |
this.movies = results.data; | |
}) | |
.catch(error => { | |
console.log(error); | |
}); | |
} | |
}; | |
</script> | |
<style> | |
#app { | |
font-family: "Avenir", Helvetica, Arial, sans-serif; | |
-webkit-font-smoothing: antialiased; | |
-moz-osx-font-smoothing: grayscale; | |
color: #2c3e50; | |
margin-top: 60px; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment