页面
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
</>
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user