aboutsummaryrefslogtreecommitdiff
path: root/client/src/components/ProductCard.vue
blob: 849c3602d9ba1e9152a44bb9fd0ab89895707382 (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">
    <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>