Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.01 KB | None | 0 0
  1. <template>
  2.     <table v-if="coins">
  3.         <tr>
  4.             <th>ID</th>
  5.             <th>Name</th>
  6.             <th>Price</th>
  7.             <th>Year</th>
  8.         </tr>
  9.         <tr v-for="coin in coins">
  10.             <td>{{coin.id}}</td>
  11.             <td>{{coin.name}}</td>
  12.             <td>{{coin.price}}</td>
  13.             <td>{{coin.year}}</td>
  14.         </tr>
  15.     </table>
  16.  
  17. </template>
  18.  
  19. <script>
  20.     export default {
  21.         //name: "GetComponent"
  22.  
  23.         data() {
  24.             return {
  25.                 coins: {},
  26.             }
  27.         },
  28.  
  29.         methods: {
  30.  
  31.             getCoins() {
  32.                 let uri = 'list';
  33.                 this.axios.get(uri)
  34.                     .then((response) => {
  35.                         this.coins = response.data;
  36.                     })
  37.             }
  38.  
  39.         },
  40.         created() {
  41.             this.getCoins();
  42.             this.eventBus.$on('update', data => {
  43.                 this.getCoins()
  44.             })
  45.         }
  46.     }
  47. </script>
  48.  
  49. <style scoped>
  50.  
  51. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement