index.html 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <link rel="stylesheet" type="text/css" href="./assets/css/style.css">
  7. <title>Product app</title>
  8. </head>
  9. <body>
  10. <div class="nav-bar"></div>
  11. <div id="app">
  12. <div class="product">
  13. <div class="product-image">
  14. <a :href="link">
  15. <!-- bind the src attribute to the "image" property -->
  16. <img
  17. v-bind:src="image"
  18. :alt="description" :title="description"
  19. /><!-- :attr is shortcut for v-bind:attr -->
  20. </a>
  21. </div>
  22. <div class="product-info">
  23. <h1 v-cloak>{{ product }}</h1>
  24. <h2>Available?</h2>
  25. <p v-cloak v-show="inventory > 10">In stock</p>
  26. <p v-cloak v-show="inventory <= 10 && inventory > 0">Limited stock</p>
  27. <p v-cloak v-show="inventory <= 0">Out of stock</p>
  28. <p v-if="onSale">On sale! Act fast.</p>
  29. <h2>Details</h2>
  30. <ul>
  31. <li v-for="detail in details">{{ detail }}</li>
  32. </ul>
  33. <h2>Colors</h2>
  34. <ul>
  35. <li v-for="variant in variants"
  36. v-bind:key="variant.variantId"
  37. @mouseover="updateImage(variant.variantImage)"
  38. ><!-- @ est le raccourci de v-on: -->
  39. {{ variant.variantColor }}
  40. </li>
  41. </ul>
  42. <h2>Sizes</h2>
  43. <ul>
  44. <li v-for="size in sizes" :key="size">{{ size }}</li>
  45. </ul>
  46. <button v-on:click="addToCart" ref="add">Add to cart</button>
  47. <button v-on:click="removeFromCart" ref="remove" class="disabledButton">Remove</button>
  48. <div class="cart">
  49. <p>Cart({{cart}})</p>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. <script src="./assets/js/vue.js"></script>
  55. <script src="main.js"></script>
  56. </body>
  57. </html>