Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <table class="table-striped" id="productsTable">
  2. <thead>
  3. <tr>
  4. <th>Nome</th>
  5. <th>Preço</th>
  6. <th>Descrição</th>
  7. </tr>
  8. </thead>
  9. <tbody>
  10. <tr v-for="product in products">
  11. <td>
  12. {{ product.name }}
  13. </td>
  14. <td>
  15. {{ product.value }}
  16. </td>
  17. <td>
  18. {{ product.description }}
  19. </td>
  20. </tr>
  21. </tbody>
  22. </table>
  23. <script>
  24. var read = require('read-file-utf8');
  25. var loki = require('lokijs');
  26. var db = new loki('db.json');
  27. var data = read(__dirname + "/db.json");
  28. db.loadJSON(data);
  29. var products = db.getCollection('products');
  30. new Vue({
  31. el: 'body',
  32. data: {
  33. products: []
  34. },
  35. ready: () => {
  36. this.products = products.data;
  37. }
  38. });
  39. require('./render.js');
  40. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement