This commit is contained in:
bwbl 2026-01-13 14:23:10 +01:00
parent d0691a96df
commit a5ea40c452
2 changed files with 59 additions and 41 deletions

View File

@ -1,37 +1,50 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Vue Mastery</title> <title>Vue Mastery</title>
<!-- Import Styles --> <!-- Import Styles -->
<link rel="stylesheet" href="./assets/styles.css" /> <link rel="stylesheet" href="./assets/styles.css" />
<!-- Import Vue.js --> <!-- Import Vue.js -->
<script src="https://unpkg.com/vue@3.0.11/dist/vue.global.js"></script> <script src="https://unpkg.com/vue@3.0.11/dist/vue.global.js"></script>
</head> </head>
<body> <body>
<div id="app"> <div id="app">
<div class="nav-bar"></div> <div class="nav-bar"></div>
<div class="product-display"> <div class="product-display">
<div class="product-container"> <div class="product-container">
<div class="product-image"> <div class="product-image">
<img v-bind:src="image"> <img v-bind:src="image" />
</div> </div>
<div class="product-info"> <div class="product-info">
<h1>{{ product }}</h1> <h1>{{ product }}</h1>
<p v-if="inStock">In Stock</p> <p v-if="inStock">In Stock</p>
<p v-else>Out of Stock</p> <p v-else>Out of Stock</p>
</div> <ul>
</div> <li v-for="detail in details">{{ detail }}</li>
</div> </ul>
</div> <label for="variants">Variants</label>
<div
id="variants"
v-for="variant in variants"
:key="variant.id"
>
{{ variant.color }}
</div>
<label for="Size">Size</label>
<div id="Size" v-for="size in sizes">{{ size }}</div>
</div>
</div>
</div>
</div>
<!-- Import App --> <!-- Import App -->
<script src="./main.js"></script> <script src="./main.js"></script>
<!-- Mount App --> <!-- Mount App -->
<script> <script>
const mountedApp = app.mount('#app') const mountedApp = app.mount("#app");
</script> </script>
</body> </body>
</html> </html>

23
main.js
View File

@ -1,10 +1,15 @@
const app = Vue.createApp({ const app = Vue.createApp({
data() { data() {
return { return {
product: 'Socks', product: "Socks",
image: './assets/images/socks_blue.jpg', image: "./assets/images/socks_blue.jpg",
inStock: true, inStock: true,
details: ['50% cotton', '30% wool', '20% polyester'] details: ["50% cotton", "30% wool", "20% polyester"],
} variants: [
} { id: 2234, color: "green" },
}) { id: 2235, color: "blue" },
],
sizes: ["S", "M", "L", "XL"],
};
},
});