Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!-- 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>
<script src="https://unpkg.com/vue@next"></script>
</head>
<body>
<div id="app">
Expand All @@ -19,6 +19,15 @@
</div>
<div class="product-info">
<h1>{{ product }}</h1>
<p v-if="onSale === true">On Sale!</p>
<p v-if="inventory > 10">In Stock</p>
<p v-else-if="inventory <= 10 && inventory > 0">
Almost sold out
(<small v-if="inventory > 1 && inventory <= 10 ">{{ inventory }} items</small>
<small v-else="inventory">{{ inventory}} item</small>
left!)
</p>
<p v-else>Out of Stock</p>
</div>
</div>
</div>
Expand Down
7 changes: 5 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ const app = Vue.createApp({
data() {
return {
product: 'Socks',
image: './assets/images/socks_blue.jpg'
image: './assets/images/socks_blue.jpg',
// inStock: true,
inventory: 1,
onSale: true
}
}
})
});