🎈 perf(购物页面): 改善滚动列表的加载
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { ScrollView, View } from "@tarojs/components"
|
||||
import React, { memo, ReactNode, useMemo, useState } from "react"
|
||||
import style from "./index.module.scss"
|
||||
import DotLoading from "@/components/dotLoading"
|
||||
import LoadingCard from "../loadingCard"
|
||||
import { ScrollView, View } from '@tarojs/components'
|
||||
import React, { memo, ReactNode, useMemo, useState } from 'react'
|
||||
import style from './index.module.scss'
|
||||
import DotLoading from '@/components/dotLoading'
|
||||
import LoadingCard from '../loadingCard'
|
||||
|
||||
export type StatusParam = 0|1|2|3
|
||||
export type StatusParam = 0 | 1 | 2 | 3
|
||||
|
||||
type Params = {
|
||||
styleObj?: React.CSSProperties
|
||||
@@ -36,7 +36,7 @@ export default memo(
|
||||
selfOnRefresherRefresh,
|
||||
selfOnRefresherRestore,
|
||||
selfOnRefresherAbort,
|
||||
safeAreaInsetBottom=true,
|
||||
safeAreaInsetBottom = true,
|
||||
enableLoadMoreStatus = true,
|
||||
children,
|
||||
lowerThresholdNum = 5,
|
||||
@@ -76,28 +76,29 @@ export default memo(
|
||||
}
|
||||
}, [statusMore])
|
||||
|
||||
|
||||
const component = () => {
|
||||
if(enableLoadMoreStatus){
|
||||
if (!moreStatus){
|
||||
if (enableLoadMoreStatus) {
|
||||
if (!moreStatus) {
|
||||
return (
|
||||
<View style={{ paddingBottom: paddingBottom + 'rpx' }} className={style.scrollViewCon}>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
}else{
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
{(statusMore == 2 || statusMore == 3) && (
|
||||
<View style={{ paddingBottom: paddingBottom + 'rpx' }} className={style.scrollViewCon}>
|
||||
{children}
|
||||
<View className={style.infinite_scroll}>
|
||||
{(statusMore == 2 && (
|
||||
{statusMore == 2 ? (
|
||||
<View className={style.loading_more}>
|
||||
加载中
|
||||
<DotLoading />
|
||||
</View>
|
||||
)) || <View className={style.noMore}>没有更多数据了</View>}
|
||||
) : (
|
||||
<View className={style.noMore}>没有更多数据了</View>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
@@ -106,8 +107,7 @@ export default memo(
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
return (
|
||||
<View style={{ paddingBottom: paddingBottom + 'rpx' }} className={style.scrollViewCon}>
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user