<template>
<view class="content">
<list :pagingEnabled="true">
<cell v-for="item in list" :keep-scroll-position="item == 5">
<view class="box" :style="{height}">
<text class="box-text">{{item}}{{item == 5}}</text>
</view>
</cell>
</list>
</view>
</template>
<script>
export default {
data() {
return {
list:[],
}
},
computed:{
height(){
return uni.getSystemInfoSync().windowHeight + 'px'
}
},
onLoad() {
setTimeout(()=>{
this.list.push(...[5,6])
this.$nextTick(()=>{
this.flag = true
setTimeout(()=>{
this.list.unshift(...[1,2,3,4])
},2000)
})
},1000)
}
}
</script>
<style lang="scss" scoped>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 750rpx;
flex: 1;
.box{
width: 750rpx;
background:#efefef;
align-items: center;
justify-content: center;
.box-text{
color: #111;
font-size: 40rpx;
}
}
}
</style>
0 个回复