<template>
<div class="container" onclick="click">
<block for="{{listData}}">
<text class="txt">{{ $item }}--{{ $idx }}</text>
</block>
</div>
</template>
<style>
.container {
flex: 1;
flex-direction: column;
align-items: center;
}
.txt {
height: 150px;
width: 85%;
align-items: flex-start;
margin-bottom: 15px;
border-color: #9400D3;
border-width: 5px;
}
</style>
<script>
import prompt from '@system.prompt'
import router from '@system.router';
export default {
data: {
listAdd: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
listData: [],
},
onInit: function () {
this.listData = [].concat(this.listAdd)
},
onReachTop: function () {
prompt.showToast({
message: "到顶部了"
})
// update page content
var that = this
for (let i = 0; i < this.listAdd.length; i++) {
this.listData[i] = this.listAdd[this.listAdd.length - i - 1]
}
var renderData = [].concat(that.listData, that.listAdd)
setTimeout(function () {
that.listData = renderData
}, 500)
},
click() {
this.$page.scrollTo({ top: 0, behavior: "smooth" });
},
newclick() {
router.push({
uri: '/New',
params: { body: " test send message", test: 'hello', newtest: 'newtest' }
})
}
}
</script>