提交 0e5db17f 编写于 作者: W wanganxp

页面滚动添加动画、补充页面下拉刷新

上级 156d12f9
......@@ -226,6 +226,13 @@
"enablePullDownRefresh": true
}
},
{
"path": "pages/API/pull-down-refresh/pull-down-refresh",
"style": {
"navigationBarTitleText": "页面级下拉刷新",
"enablePullDownRefresh": true
}
},
{
"path": "pages/API/nodes-info/nodes-info",
"style": {
......
<template>
<!-- #ifdef APP -->
<scroll-view style="flex: 1">
<scroll-view style="flex: 1" scroll-with-animation="true">
<!-- #endif -->
<view class="uni-padding-wrap">
<page-head :title="title"></page-head>
......
<template>
<view>
<page-head :title="title"></page-head>
<scroll-view>
<!-- 实际开发中,长列表应该使用list-view -->
<view class="uni-padding-wrap uni-common-mt">
<view style="font-size: 12px; color: #666;">注:PC 不支持下拉刷新</view>
<view class="text" v-for="(num,index) in data" :key="index">list - {{num}}</view>
<view class="uni-loadmore" v-if="showLoadMore">{{loadMoreText}}</view>
</view>
</view>
</scroll-view>
</template>
<script lang="uts">
export default {
data() {
return {
title: '下拉刷新 + 加载更多',
data: [],
data: [] as Array<number>,
loadMoreText: "加载中...",
showLoadMore: false,
max: 0
......@@ -22,12 +20,6 @@
onLoad() {
this.initData();
},
onUnload() {
this.max = 0,
this.data = [],
this.loadMoreText = "加载更多",
this.showLoadMore = false;
},
onReachBottom() {
console.log("onReachBottom");
if (this.max > 40) {
......@@ -48,9 +40,9 @@
setTimeout(() => {
this.max = 0;
this.data = [];
let data = [];
let data:Array<number> = [];
this.max += 20;
for (var i = this.max - 19; i < this.max + 1; i++) {
for (let i:number = this.max - 19; i < this.max + 1; i++) {
data.push(i)
}
this.data = this.data.concat(data);
......@@ -58,9 +50,9 @@
}, 300);
},
setListData() {
let data = [];
let data:Array<number> = [];
this.max += 10;
for (var i = this.max - 9; i < this.max + 1; i++) {
for (let i:number = this.max - 9; i < this.max + 1; i++) {
data.push(i)
}
this.data = this.data.concat(data);
......
......@@ -130,7 +130,7 @@ export default {
{
name: '下拉刷新',
url: 'pull-down-refresh',
enable: false,
// enable: false,
},
{
name: '将页面滚动到指定位置',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册