增加组件接口

This commit is contained in:
xiaolian
2024-07-22 10:32:41 +08:00
parent fc345108e7
commit 5fa3c74d6a
8 changed files with 97 additions and 32 deletions
+38 -24
View File
@@ -35,7 +35,7 @@ Component({
overlayStyle: {
type: String,
value: 'background-color: rgba(0, 0, 0, 0.7)'
},
},
},
attached(){
debouncetimer = null
@@ -56,26 +56,26 @@ Component({
*/
data: {
show_page: false,
// list: [],
list: [{
id: 1,
name: '宝马'
},{
id: 1,
name: '宝马'
},{
id: 1,
name: '宝马'
},{
id: 1,
name: '宝马'
},{
id: 1,
name: '宝马'
},{
id: 1,
name: '宝马'
}],
list: [],
// list: [{
// id: 1,
// name: '宝马'
// },{
// id: 1,
// name: '宝马'
// },{
// id: 1,
// name: '宝马'
// },{
// id: 1,
// name: '宝马'
// },{
// id: 1,
// name: '宝马'
// },{
// id: 1,
// name: '宝马'
// }],
cur: -1,
keyword: '',
item: {}
@@ -119,16 +119,21 @@ Component({
let that = this
that.debounce(function(){
that.setData({
keyword: e.detail.value
keyword: e.detail.value,
cur: -1,
item: {}
})
console.log(1)
},200)
if(e.detail.value){
that.apiGetMbrand(e.detail.value)
}
},500)
},
bindSelectIndex(e){
console.log(e)
this.setData({
cur: e.currentTarget.dataset.index
})
},
/**
* 函数防抖
@@ -150,5 +155,14 @@ Component({
}, gapTime)
})()
},
//app/series/mbrand
apiGetMbrand(keyword){
_.apiQuery.getMbrand({keyword}).then(res => {
this.setData({
list: res.data.list
})
})
}
}
})