支付宝小程序组件ScrollLoad
npm install ali-miniapp-scroll-load|
属性
|
类型
|
默认值
|
是否必填
|
说明
|
|
className
|
String
|
''
|
|
自定义类名
|
|
style
|
String
|
''
|
|
自定义样式
|
|
scrollX
|
Boolean
|
false
|
两者其中一项必须为真
|
允许横向滚动
|
|
scrollY
|
Boolean
|
false
|
允许纵向滚动
|
|
|
upperThreshold
|
Number
|
50
|
|
距顶部/左边多远时(单位px),触发 scrolltoupper 事件
|
|
lowerThreshold
|
Number
|
50
|
|
距底部/右边多远时(单位px),触发 scrolltolower 事件
|
|
scrollTop
|
Number
|
0
|
|
设置竖向滚动条位置
|
|
scrollLeft
|
Number
|
0
|
|
设置横向滚动条位置
|
|
scrollIntoView
|
String
|
|
|
值应为某子元素id,则滚动到该元素,元素顶部对齐滚动区域顶部
|
|
scrollWithAnimation
|
Boolean
|
false
|
|
在设置滚动条位置时使用动画过渡
|
|
onScroll
|
Function
|
null
|
|
滚动时触发,event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth},EventHandle
|
|
onScrollToUpper
|
Function
|
null
|
与滚动方向设置对应
|
滚动到顶部/左边,会触发 scrolltoupper 事件,EventHandle
|
|
onScrollToLower
|
Function
|
null
|
滚动到底部/右边,会触发 scrolltolower 事件,EventHandle
|
|
|
isErrorRequest
|
Object
|
null
|
|
请求出错Error对象
|
|
noMoreData
|
Boolean
|
false
|
是
|
列表是否还有数据
|
|
listData
|
Array
|
[]
|
是
|
列表数据
|
json
// page.json
{
"defaultTitle": "",
"usingComponents":{
"scroll-load":".../scroll-load" // 路径配置
}
}
`
示例
`html
className="hos-list-sv"
scrollY="{{true}}"
onScrollToLower="handleListScrollToLower"
isErrorRequest="{{isErrorReq}}"
noMoreData="{{noMoreData}}"
listData="{{reqResult}}"
>
共有{{searchCount}}条搜索结果
``