搜索
This commit is contained in:
parent
ef6a5868f1
commit
01d1215d5d
@ -4,5 +4,11 @@ Component({
|
||||
data: {
|
||||
},
|
||||
methods: {
|
||||
search(a){
|
||||
console.log(a)
|
||||
wx.navigateTo({
|
||||
url:"/pages/search/search?key=" + a.detail.value
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
@ -1,4 +1,4 @@
|
||||
<view class="search">
|
||||
<image></image>
|
||||
<input type="text" placeholder="输入您要搜索的产品" />
|
||||
<input type="text" confirm-type="search " bindconfirm="search" placeholder="输入您要搜索的产品" />
|
||||
</view>
|
@ -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
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -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"
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
<view class="box">
|
||||
<search></search>
|
||||
<hot></hot>
|
||||
<!-- <hot></hot> -->
|
||||
<commodity wx:for="{{list}}" title="{{item.goods_name}}" price="{{item.shop_price}}" img="{{item.image}}" shopid="{{item.goods_id}}"></commodity>
|
||||
</view>
|
Loading…
Reference in New Issue
Block a user