feat(notifications): 实现基于日期的通知消息分页加载功能
- 修改 NotificationListData 类,将 startNum/endNum 替换为 startDate/endDate - 更新 API 配置,将接口地址改为 getMsgListByDate 并开启日志显示 - 在 NotificationListView 中新增日期状态管理及加载更多控制逻辑 - 实现双数据源的通知消息获取与合并去重逻辑 - 添加通知内容数字合并处理功能,优化用户体验 - 升级 RefreshView 组件以支持可控制的加载更多行为
这个提交包含在:
父节点
1517d982e0
当前提交
b87e116808
@ -11,6 +11,9 @@ export struct RefreshView {
|
|||||||
init: boolean = true
|
init: boolean = true
|
||||||
// 第一次加载完成,是否定位到底部,默认`false`,定位到顶部
|
// 第一次加载完成,是否定位到底部,默认`false`,定位到顶部
|
||||||
positioningToBottom: boolean = false
|
positioningToBottom: boolean = false
|
||||||
|
// 自动计算是否加载更多,默认`default`。如果data的数据量可以被pageSize整除,则触发加载更多
|
||||||
|
// 'allow' 触发loadMore, ’not' 不触发loadMore
|
||||||
|
@Prop canLoadMore: 'default' | 'allow' | 'not' = 'default'
|
||||||
pageSize: number = 10
|
pageSize: number = 10
|
||||||
onLoadMore?: (pageNum: number) => void
|
onLoadMore?: (pageNum: number) => void
|
||||||
onRefresh?: () => void
|
onRefresh?: () => void
|
||||||
@ -148,7 +151,7 @@ export struct RefreshView {
|
|||||||
this.endY = e1.y
|
this.endY = e1.y
|
||||||
if (this.endY - this.startY < -100 && this._openMore) {
|
if (this.endY - this.startY < -100 && this._openMore) {
|
||||||
const v = this.data && (this.data.length % this.pageSize) === 0
|
const v = this.data && (this.data.length % this.pageSize) === 0
|
||||||
if (v) {
|
if ((v && this.canLoadMore == 'default') || this.canLoadMore == 'allow') {
|
||||||
const cTime = new Date().getTime()
|
const cTime = new Date().getTime()
|
||||||
// 2024.11.21 测试觉得刷新太多了,暂时改为1秒5间隔
|
// 2024.11.21 测试觉得刷新太多了,暂时改为1秒5间隔
|
||||||
if (cTime - this._oTime > 1500) {
|
if (cTime - this._oTime > 1500) {
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户