ProductList.vue
1.93 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<template>
<div class="tw-m-auto">
<CategoryList />
<v-container class="">
<v-item-group multiple>
<v-row>
<v-col v-for="(item, i) in productStore.list" :key="i" cols="12" lg="3" md="4" sm="6">
<v-hover v-slot="{ isHovering, props }" open-delay="200">
<v-card
:elevation="isHovering ? 16 : 2"
:class="{ 'on-hover': isHovering }"
class="mx-auto"
height="350"
width="260"
v-bind="props"
:to="`/products/detail/${item.id}`"
>
<v-img :src="item.imageUrl">
<!-- <v-expand-transition>
<div
v-if="isHovering"
class="d-flex transition-fast-in-fast-out bg-orange-darken-2 v-card--reveal tw-p-[12px] tw-text-justify"
style="height: 100%"
>
产品描述描述描述描述描述描述描述描述
</div>
</v-expand-transition> -->
</v-img>
<v-card-text class="tw-text-left">{{ item.name }}</v-card-text>
</v-card>
</v-hover>
</v-col>
</v-row>
</v-item-group>
</v-container>
</div>
</template>
<script setup lang="ts">
import { useProductListStore } from '@/stores/product_list'
import { useCategoryStore } from '@/stores/category'
import CategoryList from '@/components/CategoryList.vue'
import { watchEffect } from 'vue'
const productStore = useProductListStore()
const categoryStore = useCategoryStore()
watchEffect(() => {
if (categoryStore.selectedSubCategory) {
productStore.getList({
// productCategoryId: '78b86c6e917841cf9a292234f2805e24',
productCategoryId: categoryStore.selectedSubCategory,
pageNo: 1,
pageSize: 20
})
}
})
</script>
<style lang="scss" scoped></style>