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

23
main.js
View File

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