40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
class Search {
|
|
constructor(){
|
|
header("",'<i class="iconfont icon-sousuo" ></i>',true)
|
|
this.page = 1;
|
|
this.keyword = '';
|
|
this.clickIcon()
|
|
this.clickTag()
|
|
// this.Search()
|
|
}
|
|
async Search() {
|
|
var res = await searchServe.searchData({
|
|
page:this.page,
|
|
keyword:this.keyword
|
|
})
|
|
console.log('res',res);
|
|
if(res.length > 0){
|
|
item($('.itemBox'),res)
|
|
}
|
|
}
|
|
clickIcon(){
|
|
var that = this
|
|
click(_('.icon-sousuo'),function(){
|
|
$('.itemBox').innerHTML = ''
|
|
// console.log('搜素',$('.searchInput').value);
|
|
that.keyword = $('.searchInput').value
|
|
that.Search()
|
|
})
|
|
}
|
|
clickTag(){
|
|
var that = this
|
|
click(_('.menu_list li'),function(){
|
|
$('.itemBox').innerHTML = ''
|
|
console.log('this',this.innerText);
|
|
$('.searchInput').value = this.innerText
|
|
that.keyword = this.innerText
|
|
that.Search()
|
|
})
|
|
}
|
|
}
|
|
new Search() |