From 01d1215d5d8c53e82503274ca07597e756bee656 Mon Sep 17 00:00:00 2001 From: pplokijuhyg <1162963624@qq.com> Date: Tue, 24 Dec 2019 21:54:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/index/search/index.js | 6 ++++++ components/index/search/index.wxml | 2 +- pages/search/search.js | 20 ++++++++++++++++++-- pages/search/search.json | 5 ++++- pages/search/search.wxml | 3 ++- 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/components/index/search/index.js b/components/index/search/index.js index 3512440..4e1d3ec 100644 --- a/components/index/search/index.js +++ b/components/index/search/index.js @@ -4,5 +4,11 @@ Component({ data: { }, methods: { + search(a){ + console.log(a) + wx.navigateTo({ + url:"/pages/search/search?key=" + a.detail.value + }) + } } }) \ No newline at end of file diff --git a/components/index/search/index.wxml b/components/index/search/index.wxml index 8583369..484783f 100644 --- a/components/index/search/index.wxml +++ b/components/index/search/index.wxml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/pages/search/search.js b/pages/search/search.js index ef3f5d3..96ca448 100644 --- a/pages/search/search.js +++ b/pages/search/search.js @@ -1,18 +1,34 @@ // pages/search/search.js +import bin from "../../utils/bin" Page({ /** * 页面的初始数据 */ data: { - + list:[] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + bin.request({ + url:"Goods/search", + urldata:{ + keywords:options.key, + p:0, + sort:"", + shop_price:"", + sort_asc:"", + desc:"" + } + }).then((res)=>{ + console.log(res) + this.setData({ + list:res.data.result.goods_list + }) + }) }, /** diff --git a/pages/search/search.json b/pages/search/search.json index 13d8b15..d6590f8 100644 --- a/pages/search/search.json +++ b/pages/search/search.json @@ -1,6 +1,9 @@ { + "navigationBarTitleText": "搜索", "usingComponents": { "search":"../components/index/search/index", - "hot":"../components/search/hot/index" + "hot":"../components/search/hot/index", + "commodity":"../components/index/list/commodity/index" + } } \ No newline at end of file diff --git a/pages/search/search.wxml b/pages/search/search.wxml index f962047..d56c172 100644 --- a/pages/search/search.wxml +++ b/pages/search/search.wxml @@ -1,4 +1,5 @@ - + + \ No newline at end of file