|
@@ -19,16 +19,16 @@
|
|
|
<!-- Listing Page -->
|
|
|
<div class="container-fluid browsing-history">
|
|
|
<div class="row">
|
|
|
- <div class="col-xl-2 col-lg-2 col-md3 col-sm-6 col-6 br bb">
|
|
|
+ <div v-for="product in products" :key="product._id" class="col-xl-2 col-lg-2 col-md3 col-sm-6 col-6 br bb">
|
|
|
<div class="history-box">
|
|
|
<!-- Product Image -->
|
|
|
<a href="" class="a-link-normal">
|
|
|
- <img src="" alt="" class="img-fluid" />
|
|
|
+ <img :src="product.photo" alt="" class="img-fluid" />
|
|
|
</a>
|
|
|
|
|
|
<div class="a-spacing-top-base asin-title">
|
|
|
<span class="a-text-normal">
|
|
|
- <div class="p13n-sc-truncated">Product title</div>
|
|
|
+ <div class="p13n-sc-truncated">{{ product.title }}</div>
|
|
|
</span>
|
|
|
</div>
|
|
|
|
|
@@ -47,7 +47,7 @@
|
|
|
<!-- Product price -->
|
|
|
<div class="a-row">
|
|
|
<span class="a-size-base a-color-price">
|
|
|
- <span class="p13n-sc-price">$23</span>
|
|
|
+ <span class="p13n-sc-price">{{ product.price }}</span>
|
|
|
</span>
|
|
|
</div>
|
|
|
|
|
@@ -65,7 +65,19 @@
|
|
|
|
|
|
<script>
|
|
|
|
|
|
-export default {}
|
|
|
+export default {
|
|
|
+ async asyncData ({ $axios }) {
|
|
|
+ try {
|
|
|
+ let response = await $axios.$get('http://localhost:3000/api/products')
|
|
|
+ console.log(response)
|
|
|
+ return {
|
|
|
+ products: response.products
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style>
|