Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <template>
  2.   <div id="app">
  3.     <div class="loader"></div>
  4.     <ul>
  5.         <li v-for="item in items">  
  6.             <img :src="imageUrl + item.poster_path" alt="">
  7.             <section>
  8.                 <h3>{{ item.original_title }}</h3>
  9.                 <p>{{ item.overview }}</p>
  10.             </section>
  11.         </li>
  12.     </ul>
  13.   </div>
  14. </template>
  15.  
  16. <script>
  17. import axios from 'axios'
  18.  
  19. export default {
  20.     data() {
  21.       return{
  22.         items: [],
  23.         baseUrl: 'https://api.themoviedb.org/3',
  24.         apiKey: '8b1ba17a17906dcbf4fb0c05e57bca15',
  25.         imageUrl: 'https://image.tmdb.org/t/p/w342',
  26.       }
  27.     },
  28.     mounted() {
  29.         axios
  30.         .get(this.baseUrl + '/discover/movie?api_key=' + this.apiKey + '&sort_by=popularity.desc')
  31.         .then(response => {
  32.             this.items = response;
  33.             // this.loaded = false;
  34.         })
  35.     },
  36. };
  37. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement