You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
1.8 KiB
99 lines
1.8 KiB
// components/list/list.js
|
|
Component({
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
list:{
|
|
type: Array,
|
|
value: []
|
|
},
|
|
triggered:{ // false 将设置下拉列表复位 // 正在下拉变成true
|
|
type: Boolean,
|
|
value: false
|
|
},
|
|
refresh: { //下拉刷新
|
|
type: Boolean,
|
|
value: false
|
|
},
|
|
load: {
|
|
type: Boolean,
|
|
value: false
|
|
},
|
|
list_total: {
|
|
type: Number,
|
|
value:0
|
|
},
|
|
page_size:{
|
|
type: Number,
|
|
value:0
|
|
},
|
|
},
|
|
|
|
/**
|
|
* 组件的初始数据
|
|
*/
|
|
data: {
|
|
imageServerUrl: getApp().globalData.imageServerUrl,
|
|
top: 0,
|
|
no_have: false
|
|
},
|
|
|
|
/**
|
|
* 组件的方法列表
|
|
*/
|
|
methods: {
|
|
// 滑动开始事件
|
|
nobinddragstart(){
|
|
this.triggerEvent('nobinddragstart')
|
|
},
|
|
// 滑动结束事件
|
|
nobinddragend(){
|
|
this.triggerEvent('nobinddragend')
|
|
},
|
|
onPulling(e) {
|
|
this.triggerEvent('onPulling',e)
|
|
},
|
|
nobindscroll(e){
|
|
this.triggerEvent('nobindscroll',e)
|
|
},
|
|
onRefresh(e) {
|
|
let { refresh } = this.data;
|
|
if(refresh) return
|
|
this.setData({
|
|
triggered: true,
|
|
})
|
|
this.triggerEvent('onRefresh',e)
|
|
},
|
|
|
|
onRestore(e) {
|
|
this.setData({
|
|
triggered: false,
|
|
top: 0
|
|
})
|
|
this.triggerEvent('onRestore',e)
|
|
},
|
|
|
|
onAbort(e) {
|
|
this.setData({
|
|
triggered: false
|
|
})
|
|
console.log('被打断')
|
|
this.setData({
|
|
refresh: false,
|
|
load: false,
|
|
triggered: false
|
|
})
|
|
this.triggerEvent('onAbort',e)
|
|
},
|
|
onScrolltolower(e){
|
|
let { load } = this.data;
|
|
this.setData({
|
|
no_have: true
|
|
})
|
|
if(load) return
|
|
if(this.data.list_total == this.data.list.length) return
|
|
this.triggerEvent('onScrolltolower',e)
|
|
}
|
|
}
|
|
})
|
|
|