diff --git a/yuan ma/mp-shop/pages/cart/cart.js b/yuan ma/mp-shop/pages/cart/cart.js index 9b1def4..f52b193 100644 --- a/yuan ma/mp-shop/pages/cart/cart.js +++ b/yuan ma/mp-shop/pages/cart/cart.js @@ -1,5 +1,6 @@ const { getCart,delGoodsCart } = require("../../api/index.js") -//111111 + +Page({ /** * 页面的初始数据 @@ -13,8 +14,16 @@ const { getCart,delGoodsCart } = require("../../api/index.js") onShow(){ this.http() }, + + goDetail(e) { + const id = e.currentTarget.dataset.id; + wx.navigateTo({ + url: `/pages/goodsDetails/goodsDetails?id=${id}` + }); + }, // 根源 delCartHandle(e){ + console.log("删除按钮被点击"); console.log(e.currentTarget.dataset.id); /** * 这里有两个ID @@ -25,21 +34,21 @@ const { getCart,delGoodsCart } = require("../../api/index.js") if(res.data.status === 200){ wx.showToast({ title: '删除成功', - }) + }); this.http() }else{ wx.showToast({ title: '删除失败', - }) + }); } - }) + }); }, http(){ getCart().then(res =>{ console.log(res.data.data); this.setData({ cartData:res.data.data - }) - }) + }); + }); } }) \ No newline at end of file diff --git a/yuan ma/mp-shop/pages/cart/cart.wxml b/yuan ma/mp-shop/pages/cart/cart.wxml index 8f9ca3f..5fa94d0 100644 --- a/yuan ma/mp-shop/pages/cart/cart.wxml +++ b/yuan ma/mp-shop/pages/cart/cart.wxml @@ -1,8 +1,15 @@ - + 删除 + \ No newline at end of file diff --git a/yuan ma/mp-shop/pages/cart/cart.wxss b/yuan ma/mp-shop/pages/cart/cart.wxss index 93e2de9..fd46999 100644 --- a/yuan ma/mp-shop/pages/cart/cart.wxss +++ b/yuan ma/mp-shop/pages/cart/cart.wxss @@ -4,10 +4,11 @@ .van-swipe-cell-right{ height: 100%; width: 60px; - background-color: #f00; + background-color: rgb(255, 7, 7); text-align: center; - color: #fff; + color: rgb(255, 255, 255); font-size: 16px; font-weight: 700; padding-top: 40px; -} \ No newline at end of file + display: block; +}