|
<template>
<view class="page">
<grid-view class="g_view" id="gView" onscrolltoupper={this.onscrolltoupper}>
<cell class="cell">
<text>{item.inde}</text>
</cell>
</grid-view>
</view>
</template>
<script>
export default {
name: "tpl",
apiready() {
let arr = [];
for (let index = 0; index < 30; index++) {
arr.push({
inde:index
})
}
this.data.list = arr;
document.getElementById("gView").load({
data: arr
})
},
data() {
return {
name: "文档",
list: []
};
},
methods: {
onscrolltoupper() {
const starIndex = this.data.list.length;
let arr = [];
for (let index = starIndex; index < starIndex+30; index++) {
arr.push({
inde:index
})
}
this.data.list = arr.concat(this.data.list);
document.getElementById("gView").insert({
data: arr,
index: 0
})
}
}
};
</script>
<style>
.page {
height: 100%;
}
.g_view {
flex: 1;
}
.cell{
height: 30vw;
}
</style>
|
|