aboutsummaryrefslogtreecommitdiff
path: root/client/src/components/ProductCard.vue
blob: ebf3beb5e826fb2ba00275224e2c844e36debb63 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<template>
  <div class="card mb-3">
    <img :src="ImgLink" class="card-img-top">
    <div class="card-body">
      <h5 class="card-title">{{ Name }}</h5>
      <p class="card-text">Price: ${{ Price }}</p>
      <router-link class="btn btn-dark w-100" :to="ProductLink">Details</router-link>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ProductCard',
  props: {
    Id: String,
    Name: String,
    Img: String,
    Price: Number
  },
  computed: {
    ImgLink() {
      return `${process.env.VUE_APP_ROOT_API}/${this.Img}`;
    },
    ProductLink() {
      return `/product/${this.Id}`
    }
  }
}
</script>