index.html 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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>{{ title }}</h1>
  24. <h2>Available?</h2>
  25. <p v-cloak v-show="inStock">In stock</p>
  26. <p v-cloak v-show="!inStock">Out of stock</p>
  27. <p v-if="onSale">On sale! Act fast.</p>
  28. <h2>Details</h2>
  29. <ul>
  30. <li v-for="detail in details">{{ detail }}</li>
  31. </ul>
  32. <h2>Colors</h2>
  33. <ul>
  34. <li v-for="(variant, index) in variants"
  35. v-bind:key="variant.variantId"
  36. @mouseover="updateImage(index)"
  37. class="color-box"
  38. :style="{ backgroundColor: variant.variantColor }"
  39. /><!-- @ est le raccourci de v-on: -->
  40. </ul>
  41. <h2>Sizes</h2>
  42. <ul>
  43. <li v-for="size in sizes" :key="size">{{ size }}</li>
  44. </ul>
  45. <button v-on:click="addToCart"
  46. :disabled="!inStock"
  47. :class="{ disabledButton: !inStock }"
  48. >Add to cart</button>
  49. <div class="cart">
  50. <p>Cart({{cart}})</p>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <script src="./assets/js/vue.js"></script>
  56. <script src="main.js"></script>
  57. </body>
  58. </html>