<template>
<list-view :refresher-enabled='true'
:refresher-triggered='refresh'
@refresherrefresh='refresherrefresh'
@refresherrestore="list_view_refresherrestore"
:show-scrollbar='false'>
<list-item class="item"
v-for="(item) in list">
<view>{{item}}</view>
</list-item>
<sticky-header>
<view class="item"
style="background-color: pink;margin-top: 0;">固定</view>
</sticky-header>
<list-item class="item"
v-for="(item) in list1">
<view>{{item}}</view>
</list-item>
<sticky-header>
<view class="item"
style="background-color: #000;margin-top: 0;">固定</view>
</sticky-header>
<list-item class="item"
v-for="(item) in list1">
<view>{{item}}</view>
</list-item>
</list-view>
</template>
<script>
type z = boolean
type s = string
export default {
data() {
return {
refresh: false as Boolean,
title: 'Hello' as string,
list: [] as Array<any>,
list1: [] as Array<any>
}
},
onLoad() {
for (let i : number = 0; i < 5; i++) {
this.list.push(i)
// this.list.push('1')
}
for (let i : number = 0; i < 20; i++) {
this.list1.push(i)
// this.list.push('1')
}
this.title = '222'
console.log(this.getData('3'))
},
methods: {
getData(c : s) : z {
let a = c;
let b = 3;
return a == b.toString()
},
refresherrefresh() {
setTimeout(() => {
this.refresh = false
console.log('关闭', this.refresh);
}, 2000)
},
list_view_refresherrestore() {
console.log('复位');
// setTimeout(() => {
// this.refresh = false
// console.log('关闭', this.refresh);
// }, 2000)
}
}
}
</script>
<style>
.content {
width: 100%;
}
.item {
width: 100vw;
height: 100rpx;
background-color: red;
margin-top: 20rpx;
}
</style>
2***@qq.com (作者)
<template>
</template>
<script>
type z = boolean
type s = string
export default {
data() {
return {
refresh: true as Boolean,
title: 'Hello' as string,
list: [] as Array<any>,
list1: [] as Array<any>
}
},
onLoad() {
for (let i : number = 0; i < 5; i++) {
this.list.push(i)
// this.list.push('1')
}
for (let i : number = 0; i < 20; i++) {
this.list1.push(i)
// this.list.push('1')
}
this.title = '222'
console.log(this.getData('3'))
},
methods: {
getData(c : s) : z {
let a = c;
let b = 3;
return a == b.toString()
},
refresherrefresh() {
setTimeout(() => {
this.refresh = false
console.log('关闭', this.refresh);
}, 2000)
},
list_view_refresherrestore() {
console.log('复位');
// setTimeout(() => {
// this.refresh = false
// console.log('关闭', this.refresh);
// }, 2000)
}
}
}
</script>
<style>
.content {
width: 100%;
}
</style>
2023-12-11 17:41