61 lines
1.0 KiB
JavaScript
61 lines
1.0 KiB
JavaScript
// components/listView/index.js
|
|
Component({
|
|
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
"bindrefresherrefresh":{
|
|
type:Function
|
|
},
|
|
"refresherTriggered":{
|
|
type:Boolean,
|
|
value:false
|
|
},
|
|
"height":{
|
|
type:Number
|
|
},
|
|
loadMoreText:{
|
|
type:String,
|
|
value:'已经到底了'
|
|
},
|
|
showLoadMore:{
|
|
type:Boolean,
|
|
value:true
|
|
},
|
|
loadAll:{
|
|
type:Boolean,
|
|
value:false
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 组件的初始数据
|
|
*/
|
|
data: {
|
|
defaultHeight:''
|
|
},
|
|
lifetimes:{
|
|
attached(){
|
|
const windowInfo = wx.getWindowInfo();
|
|
this.setData({
|
|
defaultHeight:`calc(100vh)`
|
|
})
|
|
}
|
|
},
|
|
/**
|
|
* 组件的方法列表
|
|
*/
|
|
methods: {
|
|
refreshList(){
|
|
this.triggerEvent('refresh');
|
|
},
|
|
scrolling(event){
|
|
//scrollTop scrollHeight
|
|
const bottomHeight = event.detail.scrollHeight-event.detail.scrollTop-this.properties.height;
|
|
if(bottomHeight<100){
|
|
this.triggerEvent('loadMore');
|
|
}
|
|
}
|
|
}
|
|
}) |