|
|
@ -12,6 +12,7 @@ const activeId = ref("");
|
|
|
|
const el = ref<HTMLDivElement | null>(null);
|
|
|
|
const el = ref<HTMLDivElement | null>(null);
|
|
|
|
const keyword = ref("");
|
|
|
|
const keyword = ref("");
|
|
|
|
const canloadMore = ref(true);
|
|
|
|
const canloadMore = ref(true);
|
|
|
|
|
|
|
|
const isLoading = ref(false);
|
|
|
|
|
|
|
|
|
|
|
|
defineProps({
|
|
|
|
defineProps({
|
|
|
|
showFieldList: {
|
|
|
|
showFieldList: {
|
|
|
@ -28,27 +29,27 @@ function selectHandler(id: string, index: number) {
|
|
|
|
workStore.setActive(index);
|
|
|
|
workStore.setActive(index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const { isLoading } = useInfiniteScroll(
|
|
|
|
useInfiniteScroll(
|
|
|
|
el as any,
|
|
|
|
el as any,
|
|
|
|
() => {
|
|
|
|
() => {
|
|
|
|
loadMore();
|
|
|
|
loadMore();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
distance: 10,
|
|
|
|
distance: 10,
|
|
|
|
interval: 800,
|
|
|
|
interval: 1500,
|
|
|
|
canLoadMore: () => {
|
|
|
|
canLoadMore: () => canloadMore.value
|
|
|
|
// console.log('canloadmore excuted!')
|
|
|
|
|
|
|
|
return canloadMore.value;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
async function loadMore() {
|
|
|
|
async function loadMore() {
|
|
|
|
if (isLoading.value || el.value == null) return;
|
|
|
|
if (isLoading.value || el.value == null) return;
|
|
|
|
|
|
|
|
isLoading.value = true;
|
|
|
|
// console.log('loadmore')
|
|
|
|
try {
|
|
|
|
const more = await fetchList();
|
|
|
|
const more = await fetchList();
|
|
|
|
data.value.push(...more);
|
|
|
|
data.value.push(...more);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
isLoading.value = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function fetchList() {
|
|
|
|
async function fetchList() {
|
|
|
@ -56,7 +57,11 @@ async function fetchList() {
|
|
|
|
pagination.pageNo += 1;
|
|
|
|
pagination.pageNo += 1;
|
|
|
|
const result = await workStore.fetchOrderList(pagination, keyword.value);
|
|
|
|
const result = await workStore.fetchOrderList(pagination, keyword.value);
|
|
|
|
const { data, pageCount } = result;
|
|
|
|
const { data, pageCount } = result;
|
|
|
|
canloadMore.value = pageCount >= pagination.pageNo && pageCount !== 0;
|
|
|
|
if(pageCount !== 0){
|
|
|
|
|
|
|
|
canloadMore.value = pageCount >= pagination.pageNo ;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
canloadMore.value = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
return data || [];
|
|
|
|
return data || [];
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
canloadMore.value = false;
|
|
|
|
canloadMore.value = false;
|
|
|
|