This commit is contained in:
2022-04-11 18:37:36 +08:00
parent ec682e2aea
commit dc0129402c
43 changed files with 1244 additions and 128 deletions
@@ -0,0 +1,15 @@
.scroll_main{
height: 100%;
.infinite_scroll{
font-size: $font_size_medium;
color: $color_font_two;
width: 100%;
display: flex;
justify-content: center;
.loading_more{
display: flex;
align-items: center;
}
}
}
+41
View File
@@ -0,0 +1,41 @@
import { ScrollView, View } from "@tarojs/components"
import { memo, ReactNode, useState } from "react"
import style from "./index.module.scss"
import DotLoading from "@/components/dotLoading"
type Params = {
styleObj?: Object,
selfonScrollToLower?: () => void,
hasMore?: false|true,
children?: ReactNode,
lowerThresholdNum?: number,
}
export default memo(({styleObj, selfonScrollToLower, hasMore=true, children, lowerThresholdNum = 5}: Params) => {
const scrollToLower = () => {
selfonScrollToLower?.()
}
return (
<>
<ScrollView
style={styleObj}
className={style.scroll_main}
scrollY
onScrollToLower={() => scrollToLower()}
lowerThreshold={lowerThresholdNum}
>
<View>
{children}
</View>
<View className={style.infinite_scroll}>
{
hasMore&&<View className={style.loading_more}>加载中<DotLoading/></View>||
<View>没有更多了</View>
}
</View>
<View className="common_safe_area_y"></View>
</ScrollView>
</>
)
})