uniapp nvue 下拉刷新组件使用 样式 以及布局下拉都可正常使用 具体看使用方法即可
<!-- list组件 -->
<list class="listView" show-scrollbar="false">
<!-- 下拉刷新 -->
<refresh @pullingdown="pullingdown" :display="showLoading ? 'show':'hide'" @refresh="onrefresh" class="refreshLayer">
<image class="loadingImg" src="/static/app-plus/image/loading.gif"></image>
<text class="loadingTitle">刷新中...</text>
</refresh>
<cell v-for="(item,index) in dataList" :key="index">
<view class="listItemView" :style="index==0? 'margin-top:30rpx' : ''">
<view class="marginleftView">
<view class="showInformationView">
<view class="userInformationItem">
<text class="showLeftText">姓名</text>
<text class="showRightText">{{item.name}}</text>
</view>
<view class="userInformationItem">
<text class="showLeftText">手机号</text>
<text class="showRightText">{{item.phoneNum}}</text>
</view>
<view class="userInformationItem">
<text class="showLeftText">微信号</text>
<text class="showRightText">{{item.weichatNum}}</text>
</view>
<view class="userInformationItem">
<text class="showLeftText">性别</text>
<text class="showRightText">{{item.sex == 1 ? '男' : '女'}}</text>
</view>
<view class="userInformationItem">
<text class="showLeftText">出生日期</text>
<text class="showRightText">{{item.birthday}}</text>
</view>
</view>
</view>
</view>
</cell>
</list>
<script>
export default {
data() {
return {
dataList: [],
showLoading: false,
};
},
onShow() {
},
//加载完成
onLoad(options) {
this.getPageDataList(false)
},
methods: {
//下拉刷新
onrefresh() {
this.showLoading = true
//根据当前按钮判断请求数据类型
this.getPageDataList(true)
},
//获取当前页面需要展示的数据
//tp 列表数据类型
//isRefresh 是否为下拉刷新
getPageDataList: function(isRefresh) {
//判断是否为下拉刷新
if (isRefresh) {
this.showLoading = false
}
},
}
}
</script>
.listView {
flex: 1;
background-color: #F5F5F5;
margin-top: 110rpx;
padding-bottom: 100rpx;
}
.listItemView {
margin-left: 30rpx;
margin-bottom: 30rpx;
width: 690rpx;
background-color: #FFFFFF;
border-radius: 20rpx;
}
.showInformationView {
}
.userInformationItem {
margin-top: 32rpx;
flex-direction: row;
}
.showLeftText {
width: 214rpx;
font-size: 30rpx;
color: #999999;
}
.showRightText {
width: 400rpx;
font-size: 30rpx;
color: #000000;
text-align: right;
}
.refreshLayer{
left: 0;
right: 0;
padding: 20rpx;
flex-direction: row;
align-items: center;
justify-content: center;
}
.loadingImg{
width: 40rpx;
height: 40rpx;
margin-right: 20rpx;
}
.loadingTitle {
text-align: center;
font-size: 30rpx;
}