123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <!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>{{ product }}</h1>
- <h2>Available?</h2>
- <p v-cloak v-show="inventory > 10">In stock</p>
- <p v-cloak v-show="inventory <= 10 && inventory > 0">Limited stock</p>
- <p v-cloak v-show="inventory <= 0">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 in variants"
- v-bind:key="variant.variantId"
- @mouseover="updateImage(variant.variantImage)"
- ><!-- @ est le raccourci de v-on: -->
- {{ variant.variantColor }}
- </li>
- </ul>
- <h2>Sizes</h2>
- <ul>
- <li v-for="size in sizes" :key="size">{{ size }}</li>
- </ul>
- <button v-on:click="addToCart" ref="add">Add to cart</button>
- <button v-on:click="removeFromCart" ref="remove" class="disabledButton">Remove</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>
|