|
|
@@ -1,12 +1,16 @@
|
|
|
<template>
|
|
|
- <div class="product-card" @click="onPath(`/item?id=${product.id}&productNo=${product.productNo}`)">
|
|
|
- <div class="card-header" v-if="showCheckbox || showAction">
|
|
|
- <el-checkbox v-if="showCheckbox" v-model="checked" @change="handleCheck" />
|
|
|
+<!-- -->
|
|
|
+ <div class="product-card" >
|
|
|
+ <div class="card-header" v-if="showCheckbox || showAction" @click="onCheckbox">
|
|
|
+ <div @click.stop="">
|
|
|
+ <el-checkbox v-if="showCheckbox" v-model="checked" @change="handleCheck" />
|
|
|
+ </div>
|
|
|
+
|
|
|
<slot name="action">
|
|
|
- <span v-if="actionText" class="action-btn" @click="$emit('action')">{{ actionText }}</span>
|
|
|
+ <span v-if="actionText" class="action-btn" @click.stop="$emit('action')">{{ actionText }}</span>
|
|
|
</slot>
|
|
|
</div>
|
|
|
- <div class="product-image">
|
|
|
+ <div class="product-image" @click="onPath(`/item?id=${product.id}&productNo=${product.productNo}`)">
|
|
|
<el-image :src="product.image" fit="contain">
|
|
|
<template #error>
|
|
|
<div class="image-placeholder">
|
|
|
@@ -16,7 +20,7 @@
|
|
|
</el-image>
|
|
|
</div>
|
|
|
<div class="product-info">
|
|
|
- <div class="product-name">{{ product.name }}</div>
|
|
|
+ <div class="product-name" @click="onPath(`/item?id=${product.id}&productNo=${product.productNo}`)">{{ product.name }}</div>
|
|
|
<div class="product-price">
|
|
|
<span v-if="product.tag" class="price-tag">{{ product.tag }}</span>
|
|
|
<span class="current-price">¥{{ product.price }}</span>
|
|
|
@@ -70,6 +74,11 @@ watch(
|
|
|
const handleCheck = (val: boolean | string | number) => {
|
|
|
emit('update:modelValue', !!val);
|
|
|
};
|
|
|
+
|
|
|
+const onCheckbox = () => {
|
|
|
+ checked.value = !checked.value;
|
|
|
+ emit('update:modelValue', checked.value);
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
@@ -101,6 +110,7 @@ const handleCheck = (val: boolean | string | number) => {
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
padding: 10px;
|
|
|
+ cursor: pointer;
|
|
|
.el-image {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
@@ -127,6 +137,10 @@ const handleCheck = (val: boolean | string | number) => {
|
|
|
-webkit-line-clamp: 2;
|
|
|
-webkit-box-orient: vertical;
|
|
|
margin-bottom: 8px;
|
|
|
+ cursor: pointer;
|
|
|
+ &:hover {
|
|
|
+ color: #e60012;
|
|
|
+ }
|
|
|
}
|
|
|
.product-price {
|
|
|
display: flex;
|