|
@@ -9,10 +9,13 @@
|
|
|
</view>
|
|
|
<!-- 无限滚动区域 -->
|
|
|
<scroll-view class="scroll-container" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="triggered"
|
|
|
- :refresher-threshold="100" refresher-background="lightgreen" @refresherrefresh="onRefresh"
|
|
|
+ :refresher-threshold="100" refresher-background="#F3F3F4" @refresherrefresh="onRefresh"
|
|
|
@scrolltolower="onReachBottom" @refresherrestore="onRestore">
|
|
|
<slot :list="list"></slot>
|
|
|
- <view style="width: 100%;text-align: center;font-size: 14px;color:#ccc;" key="a333" v-if="isComplete">没有更多啦~</view>
|
|
|
+ <uni-load-more :status="status" :contentText="contentText"></uni-load-more>
|
|
|
+
|
|
|
+ <!-- <view style="width: 100%;text-align: center;font-size: 14px;color:#ccc;" key="a333" v-if="isComplete">没有更多啦~
|
|
|
+ </view> -->
|
|
|
</scroll-view>
|
|
|
</template>
|
|
|
|
|
@@ -20,7 +23,7 @@
|
|
|
import {
|
|
|
ref,
|
|
|
onMounted,
|
|
|
- computed
|
|
|
+ computed,
|
|
|
} from "vue";
|
|
|
|
|
|
import {
|
|
@@ -84,6 +87,12 @@
|
|
|
const name = ref(''); // 查询名
|
|
|
const activeTab = ref(props.defaultTab);
|
|
|
|
|
|
+ const status = ref('more');
|
|
|
+ const contentText = {
|
|
|
+ contentdown: '查看更多',
|
|
|
+ contentrefresh: '加载中',
|
|
|
+ contentnomore: '没有更多'
|
|
|
+ }
|
|
|
/**
|
|
|
* 是否已完全加载
|
|
|
*/
|
|
@@ -91,6 +100,7 @@
|
|
|
if (total.value === 0) {
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
return total.value === list.value.length
|
|
|
})
|
|
|
|
|
@@ -101,6 +111,7 @@
|
|
|
triggered.value = false;
|
|
|
freshing.value = false;
|
|
|
total.value = 0;
|
|
|
+ status.value = 'more';
|
|
|
}
|
|
|
|
|
|
// 切换tab
|
|
@@ -139,9 +150,17 @@
|
|
|
action === "do-search" && (list.value = res.data.data); // 查询更新
|
|
|
action === "pull-down-refresh" && (list.value = res.data.data); // 下拉更新数据
|
|
|
action === "reach-buttom" && (list.value = [...list.value, ...res.data.data]); // 无限滚动更新数据
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}).finally(() => {
|
|
|
triggered.value = false;
|
|
|
freshing.value = false;
|
|
|
+ if (total.value !== list.value.length) {
|
|
|
+ status.value = 'more';
|
|
|
+ } else {
|
|
|
+ status.value = 'noMore';
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -155,6 +174,7 @@
|
|
|
// 下拉刷新触发
|
|
|
function onRefresh() {
|
|
|
if (freshing.value) return;
|
|
|
+ status.value = 'loading';
|
|
|
freshing.value = true;
|
|
|
triggered.value = true;
|
|
|
page.value = 1;
|