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