|
@@ -1,17 +1,51 @@
|
|
|
<script setup lang="ts">
|
|
|
+import dataList from "@/data/data";
|
|
|
import BButton from "@/components/Button/index.vue";
|
|
|
+import TitleImg from "@/assets/img/product/title.png";
|
|
|
+
|
|
|
+const router = useRouter();
|
|
|
+const goBack = () => {
|
|
|
+ router.back();
|
|
|
+};
|
|
|
+const goDetail = (name: string) => {
|
|
|
+ router.push({
|
|
|
+ name: "detail",
|
|
|
+ query: {
|
|
|
+ name: name,
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const hoverIndex = ref(-1);
|
|
|
+const onHover = (index: number) => {
|
|
|
+ hoverIndex.value = index;
|
|
|
+};
|
|
|
+
|
|
|
+const getAssetURL = (image: string) => {
|
|
|
+ return new URL(`../../assets/img/product/${image}`, import.meta.url).href;
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="all">
|
|
|
- <BButton
|
|
|
- class="back-btn"
|
|
|
- @click="
|
|
|
- () => {
|
|
|
- window.history.go(-1);
|
|
|
- }
|
|
|
- "
|
|
|
- />
|
|
|
+ <BButton class="back-btn" @click="goBack()" />
|
|
|
+ <div class="title-box">
|
|
|
+ <img class="title" :src="TitleImg" alt="" />
|
|
|
+ </div>
|
|
|
+ <div class="list-box">
|
|
|
+ <div
|
|
|
+ class="list-item"
|
|
|
+ v-for="(item, index) in dataList.produces"
|
|
|
+ @mouseover="onHover(index)"
|
|
|
+ @click="goDetail(item.name)"
|
|
|
+ >
|
|
|
+ <img :src="getAssetURL(item.thumbnail)" />
|
|
|
+ <!-- 遮罩 -->
|
|
|
+ <div class="shade-box" v-show="hoverIndex == index">
|
|
|
+ {{ item.name }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -19,12 +53,60 @@ import BButton from "@/components/Button/index.vue";
|
|
|
.all {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
- // background: red;
|
|
|
+ background: url("../../assets/img/product/listBg.png");
|
|
|
+ background-size: cover;
|
|
|
+ padding-top: 3%;
|
|
|
|
|
|
.back-btn {
|
|
|
position: absolute;
|
|
|
left: 5%;
|
|
|
top: 5%;
|
|
|
}
|
|
|
+ .title-box {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .list-box {
|
|
|
+ width: 100%;
|
|
|
+ height: 70%;
|
|
|
+ padding: 0 5%;
|
|
|
+ // background: red;
|
|
|
+ margin-top: 40px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-evenly;
|
|
|
+ .list-item {
|
|
|
+ width: 20%;
|
|
|
+ height: 100%;
|
|
|
+ background: url("../../assets/img/product/listItemBg.png");
|
|
|
+ background-size: 100% 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ position: relative;
|
|
|
+ cursor: pointer;
|
|
|
+
|
|
|
+ img {
|
|
|
+ width: 80%;
|
|
|
+ object-fit: contain;
|
|
|
+ margin-left: -20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .shade-box {
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ top: 14px;
|
|
|
+ width: 92.2%;
|
|
|
+ height: 94%;
|
|
|
+ background: url("../../assets/img/product/hoverBg.png");
|
|
|
+ color: #fff3e1;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ font-size: 20px;
|
|
|
+ font-family: "AlimamaShuHeiTi-Bold";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|