L5
This commit is contained in:
parent
d0691a96df
commit
a5ea40c452
77
index.html
77
index.html
@ -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>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<!-- Import App -->
|
||||
<script src="./main.js"></script>
|
||||
<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>
|
||||
|
||||
<!-- Mount App -->
|
||||
<script>
|
||||
const mountedApp = app.mount('#app')
|
||||
</script>
|
||||
</body>
|
||||
<!-- Import App -->
|
||||
<script src="./main.js"></script>
|
||||
|
||||
<!-- Mount App -->
|
||||
<script>
|
||||
const mountedApp = app.mount("#app");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
23
main.js
23
main.js
@ -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"],
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user