<template>
<div>
<scroll-view class="message-list-container" style="height:1300rpx;widht:100%" :scroll-y="true" :scroll-top='topNum' :scroll-into-view="jumpAim" :refresher-enabled="true" @refresherrefresh="refresh" :refresher-triggered="triggered" :lower-threshold="200" @scroll="handleScroll" @scrolltolower="scrollHandler">
<div class="messageDate" >
<div v-for="(item,index) in messageDate" :key="index" :id="item.id">
<div style="height:120rpx;line-height:120rpx">昵称{{item.value}}</div>
</div>
</div>
</scroll-view>
</div>
</template>
<script>
export default {
data(){
return{
messageDate:[],
contenHeight:0,
scroll_top:0,
newHeight:0,
height:0,
triggered:false,
jumpAim:'',
}
},
onLoad(){
this.triggered = false
this.messageDate = []
this.contenHeight=0
this.scroll_top=0
this.newHeight=0
this.height=0
this.dataFn()
},
methods:{
refresh() {
this.triggered =true
this.dataFn()
this.$nextTick(()=>{
this.triggered = false
})
console.log(this.triggered,'--------------triggered')
},
dataFn(){
var a = []
var length = this.messageDate.length
var length1 = 20
for( var i=length;i<length+length1;i++ ){
a.unshift({
value:'第'+i+'条数据',
id:'id'+i
})
}
this.messageDate = [...a,...this.messageDate]
console.log(length,'-=length')
setTimeout(()=>{
this.jumpAim = this.messageDate[19].id
})
console.log(this.messageDate,this.jumpAim,length,'-----------------')
},
}
}
</script>
<style scoped>
.messageDate{
}
.messageDate1{
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>>