From 21b40c1e5fc307574eb354813045f0ef2f5accda Mon Sep 17 00:00:00 2001 From: wbb <1975655432@qq.com> Date: Fri, 11 Nov 2022 15:58:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scr/food/custom-tab-bar/index.js | 45 ------------------------------ scr/food/custom-tab-bar/index.json | 3 -- scr/food/custom-tab-bar/index.wxml | 8 ------ scr/food/custom-tab-bar/index.wxss | 38 ------------------------- scr/food/pages/detail/detail.js | 17 ++++++++++- scr/food/pages/detail/detail.wxml | 11 ++++---- scr/food/project.config.json | 4 ++- 7 files changed, 25 insertions(+), 101 deletions(-) delete mode 100644 scr/food/custom-tab-bar/index.js delete mode 100644 scr/food/custom-tab-bar/index.json delete mode 100644 scr/food/custom-tab-bar/index.wxml delete mode 100644 scr/food/custom-tab-bar/index.wxss diff --git a/scr/food/custom-tab-bar/index.js b/scr/food/custom-tab-bar/index.js deleted file mode 100644 index 19ca8b1..0000000 --- a/scr/food/custom-tab-bar/index.js +++ /dev/null @@ -1,45 +0,0 @@ -Component({ - data: { - selected: 0, - color: "#7A7E83", - selectedColor: "#3cc51f", - "list": [ - { - "pagePath": "/pages/index/index", - "text": "首页", - "iconPath": "/images/home.png", - "selectedIconPath": "/images/home-active.png" - }, - { - "pagePath": "/pages/fourm/fourm", - "text": "论坛", - "iconPath": "/images/message.png", - "selectedIconPath": "/images/message-active.png" - }, - {"pagePath": "/pages/cart/cart", - "text": "购物车", - "iconPath": "/images/message.png", - "selectedIconPath": "/images/message-active.png" - }, - { - "pagePath": "/pages/usercenter/usercenter", - "text": "我的", - "iconPath": "/images/message.png", - "selectedIconPath": "/images/message-active.png" - } - - ] - }, - attached() { - }, - methods: { - switchTab(e) { - const data = e.currentTarget.dataset - const url = data.path - wx.switchTab({url}) - this.setData({ - selected: data.index - }) - } - } -}) \ No newline at end of file diff --git a/scr/food/custom-tab-bar/index.json b/scr/food/custom-tab-bar/index.json deleted file mode 100644 index 32640e0..0000000 --- a/scr/food/custom-tab-bar/index.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "component": true -} \ No newline at end of file diff --git a/scr/food/custom-tab-bar/index.wxml b/scr/food/custom-tab-bar/index.wxml deleted file mode 100644 index 29d1b9e..0000000 --- a/scr/food/custom-tab-bar/index.wxml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - {{item.text}} - - diff --git a/scr/food/custom-tab-bar/index.wxss b/scr/food/custom-tab-bar/index.wxss deleted file mode 100644 index 0cd91e7..0000000 --- a/scr/food/custom-tab-bar/index.wxss +++ /dev/null @@ -1,38 +0,0 @@ -.tab-bar { - position: fixed; - bottom: 0; - left: 0; - right: 0; - height: 48px; - background: white; - display: flex; - padding-bottom: env(safe-area-inset-bottom); -} - -.tab-bar-border { - background-color: rgba(0, 0, 0, 0.33); - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 1px; - transform: scaleY(0.5); -} - -.tab-bar-item { - flex: 1; - text-align: center; - display: flex; - justify-content: center; - align-items: center; - flex-direction: column; -} - -.tab-bar-item cover-image { - width: 27px; - height: 27px; -} - -.tab-bar-item cover-view { - font-size: 10px; -} diff --git a/scr/food/pages/detail/detail.js b/scr/food/pages/detail/detail.js index 728336f..87deff7 100644 --- a/scr/food/pages/detail/detail.js +++ b/scr/food/pages/detail/detail.js @@ -32,7 +32,22 @@ Page({ }, // 渲染数据 - +addCar: function (event) { + // 获取 event 事件对象 + // 获取点击对应的下标 + var index = event.currentTarget.dataset.foodid; + console.log(index); + //抓取id进行赋 + //wx.navigateTo 会触发页面隐藏onHide + console.log('11111') + + wx.showToast({ + title: '加入购物车成功', + icon: 'success', + duration: 2000 + }); + + }, /** diff --git a/scr/food/pages/detail/detail.wxml b/scr/food/pages/detail/detail.wxml index d221130..b6920dc 100644 --- a/scr/food/pages/detail/detail.wxml +++ b/scr/food/pages/detail/detail.wxml @@ -1,7 +1,7 @@ - + - + {{detailObj.food_name}} {{detailObj.food_shop}} ¥{{detailObj.price}} @@ -14,6 +14,7 @@ 商品评价 东西还可以,好评~ - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/scr/food/project.config.json b/scr/food/project.config.json index 92f43ed..d4a3633 100644 --- a/scr/food/project.config.json +++ b/scr/food/project.config.json @@ -37,7 +37,9 @@ "disableUseStrict": false, "showES6CompileOption": false, "useCompilerPlugins": false, - "minifyWXML": true + "minifyWXML": true, + "ignoreDevUnusedFiles": false, + "ignoreUploadUnusedFiles": false }, "appid": "wxcc745ea897810e52", "projectname": "quickstart-wx-cloud",