Commit 6245d6bb by liangjianmin

feat(transfer): 添加骨架屏加载效果

- 新增骨架屏样式,包含渐变动画效果和按钮占位样式
- 在列表加载时显示骨架屏,提升用户体验
- 添加loading状态控制,确保骨架屏仅在首次加载且无数据时显示
- 优化列表显示逻辑,使用v-else-if避免骨架屏与列表同时显示
parent 40e28d46
......@@ -54,6 +54,37 @@
padding-bottom: 150rpx;
flex-wrap: wrap;
// 骨架屏样式
.skeleton-box {
.skeleton-item {
background: linear-gradient(90deg, #f0f0f2 25%, #e8e8e8 50%, #f0f0f2 75%);
background-size: 200% 100%;
animation: skeleton-loading 1.5s infinite;
border-radius: 6rpx;
}
.skeleton-btn {
width: 68rpx;
height: 30rpx;
background: linear-gradient(90deg, #f0f0f2 25%, #e8e8e8 50%, #f0f0f2 75%);
background-size: 200% 100%;
animation: skeleton-loading 1.5s infinite;
border-radius: 8rpx;
position: absolute;
right: 17rpx;
bottom: 13rpx;
}
}
@keyframes skeleton-loading {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
}
.box {
position: relative;
padding: 15rpx 17rpx 13rpx 17rpx;
......
......@@ -17,7 +17,20 @@
<text class="iconfont icon-a-juxing11" @click="clearInput()" v-if="input_flag"></text>
</view>
</view>
<view class="list row bothSide" v-if="list.length > 0">
<!-- 骨架屏 -->
<view class="list row bothSide" v-if="loading && list.length === 0">
<view class="box skeleton-box" v-for="i in 4" :key="'skeleton-' + i">
<view class="skeleton-item" style="width: 65%; height: 32rpx; margin-bottom: 20rpx;"></view>
<view class="skeleton-item" style="width: 50%; height: 32rpx; margin-bottom: 20rpx;"></view>
<view class="bor row"></view>
<view class="skeleton-item" style="width: 45%; height: 28rpx; margin-bottom: 16rpx;"></view>
<view class="skeleton-item" style="width: 40%; height: 28rpx; margin-bottom: 16rpx;"></view>
<view class="skeleton-item" style="width: 55%; height: 28rpx; margin-bottom: 16rpx;"></view>
<view class="skeleton-btn"></view>
</view>
</view>
<!-- 列表 -->
<view class="list row bothSide" v-else-if="list.length > 0">
<view class="box" v-for="(item, index) in list" :key="index">
<view class="text-item row verCenter">
<text class="label">移位单号:</text>
......@@ -70,6 +83,7 @@
index: 0,
array: ['移位单号'],
list: [],
loading: true, //加载状态
searchParams: {
transfer_sn: '' //移位单号
}
......@@ -95,6 +109,7 @@
* 获取列表数据
*/
getData() {
this.loading = true;
this.request(API.getTransferList, 'GET', { page: this.page, limit: this.limit, ...this.searchParams }, false).then(res => {
if (res.code === 0) {
if (res.data.list.length > 0) {
......@@ -109,6 +124,7 @@
icon: 'error'
});
}
this.loading = false;
});
},
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment