change image src in product card
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<router-link :to="`/product/${uid}`">
|
||||
<article :class="['product-card', `product-card-${type}`]">
|
||||
<img :src="coverPath" :alt="title" />
|
||||
<img :src="coverImage" :alt="title" />
|
||||
<div>
|
||||
<h2 v-if="type != 'minimal'">
|
||||
{{ category[category.length - 1]?.name }}
|
||||
@@ -38,7 +38,8 @@ const props = defineProps({
|
||||
data: { type: Object, default: {} },
|
||||
type: { type: String, default: 'main' }
|
||||
})
|
||||
const { _id: id, uid, coverPath, category = [], title, price, specialPrice, stars, orderRange } = props.data
|
||||
|
||||
const { _id: id, uid, coverImage, category = [], title, price, specialPrice, stars, orderRange } = props.data
|
||||
|
||||
const favorite = useFavoritesStore()
|
||||
const like = computed(() => favorite.find(id))
|
||||
@@ -46,7 +47,7 @@ const like = computed(() => favorite.find(id))
|
||||
const cart = useCartStore()
|
||||
const quantity = computed({
|
||||
get: () => cart.find(id)?.quantity || 0,
|
||||
set: (v) => cart.update(id, v)
|
||||
set: (v) => cart.update(props.data, v)
|
||||
})
|
||||
|
||||
const starsClass = (i) => (i > stars ? 'opacity-25' : '')
|
||||
@@ -56,7 +57,7 @@ const numberFormat = (number) =>
|
||||
|
||||
<style lang="scss">
|
||||
.product-card {
|
||||
box-shadow: 0px 2px 14px 0px #e5eef5;
|
||||
box-shadow: 0px 2px 20px 0px #e5eef5;
|
||||
@apply bg-white rounded-[0.6rem] border flex flex-col relative;
|
||||
|
||||
&>img {
|
||||
|
||||
Reference in New Issue
Block a user