From 9be4966feeee527c1dbd8a8d29906d0aa0966458 Mon Sep 17 00:00:00 2001 From: mason369 <1960638223@qq.com> Date: Fri, 20 Jan 2023 14:38:14 +0800 Subject: [PATCH] Update Details.vue Co-Authored-By: JDSA Ling <70191651+LingASDJ@users.noreply.github.com> --- src/views/Details.vue | 106 +++++++++++++++++++++++++----------------- 1 file changed, 64 insertions(+), 42 deletions(-) diff --git a/src/views/Details.vue b/src/views/Details.vue index 5857ed3..bc8f5c9 100644 --- a/src/views/Details.vue +++ b/src/views/Details.vue @@ -5,25 +5,27 @@
- +
@@ -65,10 +67,13 @@
  • - +
    {{ item.name }}
    @@ -133,14 +138,14 @@ import Crumb from "@/components/Crumb"; import { reqGetDetail } from "@/request/api"; export default { components: { Crumb }, - watch : { - "$route.query.id": { - handler() { - //刷新页面 - this.$router.go(0); - } - } - }, + // watch : { + // "$route.query.id": { + // handler() { + // //刷新页面 + // this.$router.go(0); + // } + // } + // }, data() { return { stepNum : 2, @@ -149,16 +154,33 @@ export default { //可以兑换 themYouCanBuy: [], // 商品详情的数据 - productInfo : {} + productInfo : {}, + opacity : 0 }; }, - async created() { + created() { const goodsId = this.$route.query.id; - const { data: res } = await reqGetDetail(goodsId); - const { productInfo, nav, themYouCanBuy } = res; - this.productInfo = productInfo; - this.nav = nav; - this.themYouCanBuy = themYouCanBuy; + this.getDetailsInfo(goodsId); + }, + methods: { + getNewPage(id) { + this.$router.push({ + path : "/detail", + query: { id } + }); + this.getDetailsInfo(id); + }, + async getDetailsInfo(goodsId) { + const { data: res } = await reqGetDetail(goodsId); + const { productInfo, nav, themYouCanBuy } = res; + this.productInfo = productInfo; + this.nav = nav; + this.themYouCanBuy = themYouCanBuy; + }, + imgTab(i,src) { + this.opacity = i + this.productInfo.coverImg =src + } } }; @@ -186,16 +208,16 @@ export default { li { width: 100px; height: 100px; - background-color: #cff; + // background-color: #cff; cursor: pointer; - img { - filter: brightness(50%); - } - &:hover { - img { - filter: brightness(100%); - } - } + // img { + // filter: brightness(60%); + // } + // &:hover { + // img { + // filter: brightness(100%); + // } + // } } } }