uniap上拉加载样式的实现

上拉加载样式实现

//调用组件
<me-scroll @goods="getgoods" :upLoadType="upLoadType">
//内容,要遍历的数据等...
</me-scroll>
<script>
getgoods(e){
			if(e.data){
				this.page += 1
				this.lecturerSpecial(this.page)
			}
		}
</script>
//组件
<template>
	<view class="folt">
		<scroll-view scroll-y="true" class="scroll-Y"
			@scrolltolower="lower" @scroll="scroll">
			<view class="">
				<slot></slot><!-- 插槽 -->
				<view v-if="showupwarp" class="mescroll-upwarp" style="background:#ffffff;color:#ccc">
					<view class="upwarp" v-show="upLoadType===1">
						<!-- <view class="upwarp-progress mescroll-rotate" style="border-color:#eeeeee"></view> -->
						<image class="tp" src="../../static/image/loading-2.png" mode=""></image>
						<view class="upwarp-tip">
							加载中...
						</view>
					</view>
					<view v-if="upLoadType===2" class="upwarp-nodata">
						没有更多了~
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>
<script>
export default {
	components: {
	},
		data() {
			return {
				// upLoadType:0,
				goods: [], //列表数据
				tabs: ['全部', '奶粉', '面膜', '图书'],
				tabIndex: 0, // tab下标
				 // 列表总数量
				totalNum: 60,
				//  页码 默认1开始
				curPageNum: 1,
				showupwarp:true,
				// 列表数组
				projectList: [],
			};
		},
		props:{
			upLoadType:{//1加载中//2没有更多了
				type:Number,
				default:0,
			}
		},
		onLoad() {

		},
		methods: {
			scroll(e){
				// console.log(e)
			},
			lower(){
				this.showupwarp = true
				let data={}
				if(this.upLoadType==2){
					data.data=false
					this.$emit('goods',data)
				}else{
					data.data=true
					this.$emit('goods',data)
				}
				// this.showupwarp = true
				// // if(this.upLoadType==2){
				// 	this.upLoadType = 1//加载
				// 	console.log("加载更多")
					setTimeout(() => {
						this.showupwarp = false
						// 数据请求完成后隐藏加载框
						// this.upLoadType = 2//无更多
					}, 1500);
				// // }
			},
		}
	};
</script>
<style>
.scroll-Y {
	height: 500px;
}

.mescroll-upwarp{
	height: 40px;
	padding-bottom: 20px;
	display: flex;
	justify-content: center;
	align-items: center;
}
.mescroll-upwarp .upwarp{
	display: flex;
	justify-content: center;
}
.mescroll-upwarp image{
	width: 35px;
	height: 35px;
}
.upwarp-tip{
	font-size: 25px;
}
@Keyframes donut-spin {
   0% {
     transform: rotate(0deg);
   }
 
   100% {
     transform: rotate(360deg);
   }
}
 
.tp {
   animation: donut-spin 1s linear infinite;
}
</style>

  • 6
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值