12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" type="text/css" href="./assets/css/style.css">
- <title>Product app</title>
- </head>
- <body>
- <div class="nav-bar"></div>
- <div id="app">
- <div class="product">
- <div class="product-image">
- <a :href="link">
- <!-- bind the src attribute to the "image" property -->
- <img
- v-bind:src="image"
- :alt="description" :title="description"
- /><!-- :attr is shortcut for v-bind:attr -->
- </a>
- </div>
- <div class="product-info">
- <h1 v-cloak>{{ title }}</h1>
- <h2>Available?</h2>
- <p v-cloak v-show="inStock">In stock</p>
- <p v-cloak v-show="!inStock">Out of stock</p>
- <p v-if="onSale">On sale! Act fast.</p>
- <h2>Details</h2>
- <ul>
- <li v-for="detail in details">{{ detail }}</li>
- </ul>
- <h2>Colors</h2>
- <ul>
- <li v-for="(variant, index) in variants"
- v-bind:key="variant.variantId"
- @mouseover="updateImage(index)"
- class="color-box"
- :style="{ backgroundColor: variant.variantColor }"
- /><!-- @ est le raccourci de v-on: -->
- </ul>
- <h2>Sizes</h2>
- <ul>
- <li v-for="size in sizes" :key="size">{{ size }}</li>
- </ul>
- <button v-on:click="addToCart"
- :disabled="!inStock"
- :class="{ disabledButton: !inStock }"
- >Add to cart</button>
- <div class="cart">
- <p>Cart({{cart}})</p>
- </div>
- </div>
- </div>
- </div>
- <script src="./assets/js/vue.js"></script>
- <script src="main.js"></script>
- </body>
- </html>
|