update:z-paging from 2.7.11 => 2.8.6

pull/147/head
YunaiV 2025-04-29 11:53:42 +08:00
parent c7d101cd05
commit 68ed6e1810
33 changed files with 3021 additions and 933 deletions

View File

@ -1,74 +1,41 @@
## 2.7.112024-06-28
1.`新增` 方法`updateVirtualListRender`,支持手动触发虚拟列表渲染更新。
2.`新增` 延迟加载列表演示。
3.`修复` v2.7.8引出的vue3+npm+微信小程序中,`uni.$zp`配置失效的问题。
4.`修复` 在本地分页+虚拟列表情况下虚拟列表cell未被正常销毁的问题。
5.`修复` 打开调试模式下无法获取getApp导致的`cannot read property 'zp_handleQueryCallback' of undefined`的报错。
6.`修复` 极小概率出现的分页请求较快且快速滚动到底部时未能加载更多的问题。
## 2.7.102024-05-10
1.`修复` v2.7.8引出的vue3+npm+微信小程序中uni.$zp配置失效的问题。
## 2.7.92024-05-10
1.`修复` 在新版HbuilderX+vue3+微信小程序中可能出现的加载第二页数据后返回顶部无法下拉的问题。
2.`修复` 在vue3+抖音小程序中可能出现的首次加载reload没有触发的问题。
3.`优化` ts类型中`ZPagingInstance`泛型不必填,默认为`any`。
## 2.7.82024-05-09
1.`新增` typescript类型声明文件感谢小何同学提供。
2.`新增` 添加极简写法fetch相关配置及示例。
3.`新增` `fixed-cellHeight`配置支持在虚拟列表中自定义固定的cell高度。
4.`新增` `refresher-refreshing-scrollable`配置,支持自定义下拉刷新中是否允许列表滚动。
5.`修复` 在新版HubilderX+vue3+h5中`swiper-demo`模式`slot=top`被导航栏遮挡的问题。
6.`修复` 下拉进入二楼偶现的二楼高度未铺满全屏的问题。
7.`修复` 虚拟列表中complete若传相同对象会导致key重复的问题。
8.`修复` 在虚拟列表中调用refresh后缓存高度原始数据未清空的问题。
9.`修复` 聊天记录模式删除记录时顶部显示loading的问题。
9.`优化` `scrollIntoViewByIndex`支持在虚拟列表中滚动到指定cell。
10.`优化` `content-z-index`默认值修改为1。
## 2.7.72024-04-01
1.`新增` 下拉进入二楼功能及相关配置&demo。
2.`新增` 虚拟列表写法添加【非内置列表】写法可良好兼容vue3中的各平台并有较优的性能表现。
3.`新增` `z-paging-cell`补充`@touchstart`事件。
4.`修复` 页面滚动模式设置了`auto-full-height`后可能出现的依然有异常空白占位的问题和下拉刷新时列表数据被切割的问题。
## 2.7.62024-02-29
1.`新增` `max-width`,支持设置`z-paging`的最大宽度,默认`z-paging`宽度铺满窗口。
2.`新增` `chat-adjust-position-offset`,支持设置使用聊天记录模式中键盘弹出时占位高度偏移距离。
3.`修复` 由于renderjs中聊天记录模式判断不准确导致的可能出现的从聊天记录页面跳转到其他页面后返回页面无法滚动的问题。
4.`修复` 聊天记录模式首次加载失败后,发送消息顶部会显示加载失败文字的问题。
5.`修复` 聊天记录模式nvue可能出现的键盘弹出无法滚动到底部的问题。
6.`修复` 聊天记录模式+nvue滚动条无法展示的问题&底部会显示加载中的问题。
7.`修复` 聊天记录模式监听键盘弹出可能出现的无法正常销毁的问题。
8.`修复` 直接修改dataList的值组件内部的值未更新的问题。
## 2.7.52024-01-23
1.`新增` props`chat-loading-more-default-as-loading`,支持设置在聊天记录模式中滑动到顶部状态为默认状态时,以加载中的状态展示。
2.`新增` slots`chatNoMore`支持自定义聊天记录模式没有更多数据view。
3.`修复` 固定在底部view可能出现默认黄色的问题。
4.`优化` 聊天记录加载更多样式,与普通模式对齐,支持点击加载更多&点击重试,并支持加载更多相关配置。
5.`优化` 微调下拉刷新和底部加载更多样式。
6.`优化` 聊天记录模式自动滚动到底部添加延时以避免可能出现的滚动到底部位置不正确的问题。
7.`优化` 使用新的判断滚动到顶部算法以解决在安卓设备中可能出现的因滚动到顶部时scrollTop不为0导致的下拉刷新被禁用的问题。
## 2.7.42024-01-14
1.`新增` props:`auto-adjust-position-when-chat`支持设置使用聊天记录模式中键盘弹出时是否自动调整slot="bottom"高度。
2.`新增` props:`auto-to-bottom-when-chat`,支持设置使用聊天记录模式中键盘弹出时是否自动滚动到底部。
3.`新增` props:`show-chat-loading-when-reload`支持设置使用聊天记录模式中reload时是否显示chatLoading。
4.`修复` 在聊天记录模式中`scrollIntoViewById`和`scrollIntoViewByNodeTop`无效的问题。
5.`优化` 聊天记录模式底部安全区域针对键盘开启/关闭兼容处理。
6.`优化` 更新内置的空数据图&加载失败图感谢图鸟UI提供的免费可商用的空数据图和加载失败图
## 2.7.32024-01-10
1.`新增` 聊天记录模式支持虚拟列表&添加相关demo。
2.`新增` nvue中list添加`@scrollend`监听。
3.`优化` 聊天记录模式+vue第一页并且没有更多时不倒置列表。
4.`优化` 聊天记录模式+nvue中数据不满屏时默认从顶部开始不进行列表倒置。
## 2.7.22024-01-09
1.`修复` `vue3+h5`中报错`uni.onKeyboardHeightChange is not a function`的问题。
2.`优化` 聊天记录模式细节:表情面板在触摸列表时隐藏&添加隐藏动画。
## 2.7.12024-01-08
1.`新增` `keyboardHeightChange` event支持监听键盘高度改变。
2.`新增` 聊天记录模式新增切换表情面板/键盘demo。
3.`优化` 键盘弹出占位添加动画效果。
## 2.7.02024-01-07
2024新年快乐祝大家在新的一年里工作顺利事事顺心
1.`新增` 全新的聊天记录模式设计将vue中的聊天记录模式与nvue中对齐完全解决了聊天记录模式滚动到顶部加载更多在vue中抖动的问题同时将聊天记录模式键盘自动弹出自动上推页面交由`z-paging`处理,解决了由此引发的各种问题,尤其是在微信小程序中导航栏被键盘顶出屏幕外的问题。如果您使用了`z-paging`的聊天记录模式强烈建议更新写法有一定变更具体请参见demo。
2.`新增` `swiper-demo`新增`onShow`时候调用reload演示。
3.`修复` 修复滚动相关方法在微信小程序中首次滚动动画无效的问题。
4.`修复` props设置单位单位为px时报错的问题。
5.`修复` 在某些情况下`z-paging`加载了但是未渲染时reload无效的问题。
6.`修复` 底部loading动画未生效的问题。
## 2.8.62025-03-17
1.`新增` 聊天记录模式流式输出类似chatGPT回答演示demo。
2.`新增` z-paging及其公共子组件支持`HBuilderX`代码文档提示。
3.`新增` props`virtual-in-swiper-slot`用以解决vue3+(微信小程序或QQ小程序)中使用非内置列表写法时若z-paging在`swiper-item`中存在的无法获取slot插入的cell高度进而导致虚拟列表失败的问题。
4.`新增` `@scrolltolower`和@`scrolltoupper`支持nvue。
5.`修复` 由`v2.8.1`引出的方法`scrollIntoViewById`在微信小程序+vue3中无效的问题。
6.`修复` 由`v2.8.1`引出的在子组件内使用z-paging虚拟列表无效的问题。
7.`修复` 在微信小程序中基础库版本较高时`wx.getSystemInfoSync is deprecated`警告。
8.`优化` 提升下拉刷新在鸿蒙Next中的性能。
9.`优化` `@scrolltolower`和`@scrolltoupper`在倒置的聊天记录模式下的触发逻辑。
10.`优化` 其他细节调整。
## 2.8.52025-02-09
1.`新增` 方法`scrollToX`支持控制x轴滚动到指定位置。
2.`修复` 快手小程序中报错`await isn't allowed in non-async function`的问题。
3.`修复` 在iOS+nvue中设置了`:loading-more-enabled="false"`后,调用`scrollToBottom`无法滚动到底部的问题。
4.`修复` 在支付宝小程序+页面滚动中,数据为空时空数据图未居中的问题。
5.`优化` fetch types修改。
## 2.8.42024-12-02
1.`修复` 在虚拟列表+vue2中顶部占位采用transformY方案在虚拟列表+vue3中顶部占位采用view占位方案。以解决在vue2+微信小程序+安卓+兼容模式中,可能出现的虚拟列表闪动的问题。
2.`修复` 在列表渲染时(尤其是在虚拟列表中)偶现的【点击加载更多】闪现的问题。
3.`优化` 统一在RefresherStatus枚举中Loading取值。
4.`优化` `defaultPageNo`&`defaultPageSize`修改为只允许number类型。
5.`优化` 提升兼容性&细节优化。
## 2.8.32024-11-27
1.`修复` `doInsertVirtualListItem`插入数据无效的问题。
2.`优化` 提升兼容性&细节优化。
## 2.8.22024-11-25
1.`优化` types中`ZPagingRef`和`ZPagingInstance`支持泛型。
## 2.8.12024-11-24
1.`新增` 完整的`props`、`slots`、`methods`、`events`的typescript types声明可在ts中获得绝佳的代码提示体验。
2.`新增` `virtual-cell-id-prefix`虚拟列表cell id的前缀适用于一个页面有多个虚拟列表的情况用以区分不同虚拟列表cell的id。
3.`修复` 在vue3+(微信小程序或QQ小程序)中,使用非内置列表写法时,若`z-paging`在`swiper-item`标签内的情况下存在的无法获取slot插入的cell高度的问题。
4.`修复` 在虚拟列表中分页数据小于1页时插入新数据虚拟列表未生效的问题。
5.`修复` 在虚拟列表中调用`refresh`时cell的index计算不正确的问题。
6.`修复` 在快手小程序中内容较少或空数据时`z-paging`未能铺满全屏的问题。
7.`优化` `events`中的参数涉及枚举的部分统一由之前的number类型修改为string类型展示更直观涉及的events`@query`中的`from`参数;`@refresherStatusChange`中的`status`参数;`@loadingStatusChange`中的`status`参数;`slot=refresher`中的`refresherStatus`参数;`slot=chatLoading`中的`loadingMoreStatus`参数。更新版本请特别留意!
## 2.8.02024-10-21
1.`新增` 全面支持鸿蒙Next。
2.`修复` 设置了`refresher-complete-delay`后在下拉刷新期间调用reload导致的无法再次下拉刷新的问题。
3.`优化` 废弃虚拟列表transformY顶部占位方案修改为空view占位。解决因使用旧方案导致的vue3中可能出现的虚拟列表闪动问题。提升虚拟列表的兼容性。

View File

@ -18,6 +18,14 @@
</template>
<script>
/**
* z-paging-cell 组件
* @description 用于兼容 nvue vue 中的 cell 渲染因为在 nvue z-paging 内置的是 list因此列表 item 必须使用 cell 包住 vue 中不能使用 cell否则会报组件找不到的错误此子组件为了兼容这两种情况内部作了条件编译处理
* @tutorial https://z-paging.zxlee.cn/api/sub-components/main.html#z-paging-cell
* @notice 以下为 z-paging-cell 的配置项
* @property {Object} cellStyle cell 样式默认为 {}
* @example <z-paging-cell :cellStyle="{ backgroundColor: '#f0f0f0' }"></z-paging-cell>
*/
export default {
name: "z-paging-cell",
props: {

View File

@ -17,6 +17,26 @@
<script>
import zStatic from '../z-paging/js/z-paging-static'
/**
* z-paging-empty-view 空数据组件
* @description 通用的 z-paging 空数据组件
* @tutorial https://z-paging.zxlee.cn/api/sub-components/main.html#z-paging-empty-view
* @property {Boolean} emptyViewFixed 空数据图片是否铺满 z-paging默认为 false若设置为 true则为填充满 z-paging 的剩余部分
* @property {String} emptyViewText 空数据图描述文字默认为 '没有数据哦~'
* @property {String} emptyViewImg 空数据图图片默认使用 z-paging 内置的图片 (建议使用绝对路径开头不要添加 "@"请以 "/" 开头)
* @property {String} emptyViewReloadText 空数据图点击重新加载文字默认为 '重新加载'
* @property {Object} emptyViewStyle 空数据图样式可设置空数据 view top : empty-view-style="{'top':'100rpx'}" (如果空数据图不是 fixed 布局则此处是 margin-top)默认为 {}
* @property {Object} emptyViewImgStyle 空数据图 img 样式默认为 {}
* @property {Object} emptyViewTitleStyle 空数据图描述文字样式默认为 {}
* @property {Object} emptyViewReloadStyle 空数据图重新加载按钮样式默认为 {}
* @property {Boolean} showEmptyViewReload 是否显示空数据图重新加载按钮(无数据时)默认为 false
* @property {Boolean} isLoadFailed 是否是加载失败默认为 false
* @property {String} unit 空数据图中布局的单位默认为 'rpx'
* @event {Function} reload 点击了重新加载按钮
* @event {Function} viewClick 点击了空数据图 view
* @example <z-paging-empty-view empty-view-text="" />
*/
export default {
name: "z-paging-empty-view",
data() {

View File

@ -26,6 +26,23 @@
<script>
import zPaging from '../z-paging/z-paging'
/**
* z-paging-swiper-item 组件
* @description swiper+list极简写法中使用到实际上就是对普通的swiper+list中swiper-item的包装封装用以简化写法但个性化配置局限较多
* @tutorial https://z-paging.zxlee.cn/api/sub-components/main.html#z-paging-swiper-item
* @notice 以下为 z-paging-swiper-item 的配置项
* @property {Number} tabIndex 当前组件的 index也就是当前组件是 swiper 中的第几个默认为 0
* @property {Number} currentIndex 当前 swiper 切换到第几个 index默认为 0
* @property {Boolean} useVirtualList 是否使用虚拟列表默认为 false
* @property {Boolean} useInnerList 是否在 z-paging 内部循环渲染列表内置列表默认为 false useVirtualList true则此项恒为 true
* @property {String} cellKeyName 内置列表 cell key 名称 nvue 有效 nvue 中开启 useInnerList 时必须填此项默认为 ''
* @property {Object} innerListStyle innerList 样式默认为 {}
* @property {Number|String} preloadPage 预加载的列表可视范围列表高度页数默认为 12此数值越大则虚拟列表中加载的 dom 越多内存消耗越大会维持在一个稳定值但增加预加载页面数量可缓解快速滚动短暂白屏问题
* @property {String} cellHeightMode 虚拟列表 cell 高度模式默认为 'fixed'也就是每个 cell 高度完全相同将以第一个 cell 高度为准进行计算可选值dynamic即代表高度是动态非固定的dynamic性能低于fixed
* @property {Number|String} virtualListCol 虚拟列表列数默认为 1常用于每行有多列的情况例如每行有 2 列数据需要将此值设置为 2
* @property {Number|String} virtualScrollFps 虚拟列表 scroll 取样帧率默认为 60过高可能出现卡顿等问题
* @example <z-paging-swiper-item ref="swiperItem" :tabIndex="index" :currentIndex="current" @query="queryList" @updateList="updateList"></z-paging-swiper-item>
*/
export default {
name: "z-paging-swiper-item",
components: { zPaging },

View File

@ -28,6 +28,15 @@
<script>
import commonLayoutModule from '../z-paging/js/modules/common-layout'
/**
* z-paging-swiper 组件
* @description swiper 中使用 z-paging 左右滑动切换列表在根节点使用 z-paging-swiper其相当于一个 view 容器默认铺满全屏可免计算高度直接插入 swiper 的视图容器
* @tutorial https://z-paging.zxlee.cn/api/sub-components/main.html#z-paging-swiper
* @property {Boolean} fixed 是否使用 fixed 布局默认为 true
* @property {Boolean} safeAreaInsetBottom 是否开启底部安全区域适配默认为 false
* @property {Object} swiperStyle z-paging-swiper 样式默认为 {}
* @example <z-paging-swiper :safeAreaInsetBottom="true"></z-paging-swiper>
*/
export default {
name: "z-paging-swiper",
mixins: [commonLayoutModule],
@ -57,7 +66,7 @@
},
mounted() {
this.$nextTick(() => {
this.systemInfo = uni.getSystemInfoSync();
this.systemInfo = this._getSystemInfoSync();
setTimeout(this.updateFixedLayout, 100)
})
// #ifndef APP-PLUS

View File

@ -55,8 +55,12 @@
},
//
ownLoadingMoreText() {
const statusTextArr = [this.c.defaultText,this.c.loadingText,this.c.noMoreText,this.c.failText];
return statusTextArr[this.finalStatus];
return {
[this.M.Default]: this.c.defaultText,
[this.M.Loading]: this.c.loadingText,
[this.M.NoMore]: this.c.noMoreText,
[this.M.Fail]: this.c.failText,
}[this.finalStatus];
},
//
finalStatus() {

View File

@ -39,7 +39,6 @@
data() {
return {
R: Enum.Refresher,
isIos: uni.getSystemInfoSync().platform === 'ios',
refresherTimeText: '',
zTheme: {
title: { white: '#efefef', black: '#555555' },
@ -51,20 +50,27 @@
};
},
props: ['status', 'defaultThemeStyle', 'defaultText', 'pullingText', 'refreshingText', 'completeText', 'goF2Text', 'defaultImg', 'pullingImg',
'refreshingImg', 'completeImg', 'refreshingAnimated', 'showUpdateTime', 'updateTimeKey', 'imgStyle', 'titleStyle', 'updateTimeStyle', 'updateTimeTextMap', 'unit'
'refreshingImg', 'completeImg', 'refreshingAnimated', 'showUpdateTime', 'updateTimeKey', 'imgStyle', 'titleStyle', 'updateTimeStyle', 'updateTimeTextMap', 'unit', 'isIos'
],
computed: {
ts() {
return this.defaultThemeStyle;
},
//
statusTextArr() {
// Map
statusTextMap() {
this.updateTime();
return [this.defaultText, this.pullingText, this.refreshingText, this.completeText, this.goF2Text];
const { R, defaultText, pullingText, refreshingText, completeText, goF2Text } = this;
return {
[R.Default]: defaultText,
[R.ReleaseToRefresh]: pullingText,
[R.Loading]: refreshingText,
[R.Complete]: completeText,
[R.GoF2]: goF2Text,
};
},
//
currentTitle() {
return this.statusTextArr[this.status] || this.defaultText;
return this.statusTextMap[this.status] || this.defaultText;
},
// class
leftImageClass() {

View File

@ -193,6 +193,10 @@
z-index: 999;
}
.zp-back-to-top-img-inversion {
transform: rotate(180deg);
}
.zp-empty-view {
/* #ifdef APP-NVUE */
height: 100%;

View File

@ -89,10 +89,10 @@ export default {
!callbacked && this._handleToTop();
})
},
// 处理滚动到顶部
// 处理滚动到顶部(聊天记录模式中为滚动到底部)
_handleToTop() {
!this.backToTopWithAnimate && this._checkShouldShowBackToTop(0);
this.scrollToTop(this.backToTopWithAnimate);
!this.useChatRecordMode ? this.scrollToTop(this.backToTopWithAnimate) : this.scrollToBottom(this.backToTopWithAnimate);
},
// 判断是否要显示返回顶部按钮
_checkShouldShowBackToTop(scrollTop) {

View File

@ -1,4 +1,5 @@
// [z-paging]通用布局相关模块
import u from '.././z-paging-utils'
// #ifdef APP-NVUE
const weexDom = weex.requireModule('dom');
@ -40,7 +41,7 @@ export default {
isOldWebView() {
// #ifndef APP-NVUE || MP-KUAISHOU
try {
const systemInfos = uni.getSystemInfoSync().system.split(' ');
const systemInfos = u.getSystemInfoSync(true).system.split(' ');
const deviceType = systemInfos[0];
const version = parseInt(systemInfos[1]);
if ((deviceType === 'iOS' && version <= 10) || (deviceType === 'Android' && version <= 6)) {
@ -78,7 +79,7 @@ export default {
// 更新fixed模式下z-paging的布局
updateFixedLayout() {
this.fixed && this.$nextTick(() => {
this.systemInfo = uni.getSystemInfoSync();
this.systemInfo = u.getSystemInfoSync();
})
},
// 获取节点尺寸
@ -106,6 +107,12 @@ export default {
//#ifdef MP-ALIPAY
inDom = false;
//#endif
/*
inDom可能是truefalse也可能是具体的dom节点
如果inDom不为false则使用uni.createSelectorQuery().in()进行查询如果inDom为true则in中的是this否则in中的为具体的dom
如果inDom为false则使用uni.createSelectorQuery()进行查询
*/
let res = !!inDom ? uni.createSelectorQuery().in(inDom === true ? this : inDom) : uni.createSelectorQuery();
scrollOffset ? res.select(select).scrollOffset() : res.select(select).boundingClientRect();
return new Promise((resolve, reject) => {
@ -136,6 +143,10 @@ export default {
this.cssSafeAreaInsetBottom = res ? res[0].height : -1;
res && success && success();
});
},
// 同步获取系统信息兼容不同平台供z-paging-swiper使用
_getSystemInfoSync(useCache = false) {
return u.getSystemInfoSync(useCache);
}
}
}

View File

@ -8,7 +8,7 @@ export default {
props: {
// 自定义初始的pageNo默认为1
defaultPageNo: {
type: [Number, String],
type: Number,
default: u.gc('defaultPageNo', 1),
observer: function(newVal) {
this.pageNo = newVal;
@ -16,7 +16,7 @@ export default {
},
// 自定义pageSize默认为10
defaultPageSize: {
type: [Number, String],
type: Number,
default: u.gc('defaultPageSize', 10),
validator: (value) => {
if (value <= 0) u.consoleErr('default-page-size必须大于0');
@ -473,14 +473,10 @@ export default {
if (!isLocal && tempIsUserPullDown && this.isFirstPage) {
this.isUserPullDown = false;
}
if (!this.isFirstPage) {
this.listRendering = true;
this.$nextTick(() => {
u.delay(() => this.listRendering = false);
})
} else {
this.listRendering = false;
}
this.listRendering = true;
this.$nextTick(() => {
u.delay(() => this.listRendering = false);
})
let dataTypeRes = this._checkDataType(data, success, isLocal);
data = dataTypeRes.data;
success = dataTypeRes.success;
@ -511,7 +507,9 @@ export default {
const localPageNo = this.defaultPageNo;
const localPageSize = this.queryFrom !== Enum.QueryFrom.Refresh ? this.defaultPageSize : this.currentRefreshPageSize;
this._localPagingQueryList(localPageNo, localPageSize, 0, res => {
this.completeByTotal(res, this.totalLocalPagingList.length);
u.delay(() => {
this.completeByTotal(res, this.totalLocalPagingList.length);;
}, 0)
})
} else {
// 如果当前不是本地分页,则按照正常分页逻辑进行数据处理&emit数据
@ -538,7 +536,7 @@ export default {
this._callDataPromise(false);
this.loadingStatus = Enum.More.Fail;
this.isHandlingRefreshToPage = false;
if (this.loadingType === Enum.LoadingType.LoadingMore) {
if (this.loadingType === Enum.LoadingType.LoadMore) {
this.pageNo --;
}
}

View File

@ -7,18 +7,12 @@ import u from '.././z-paging-utils'
import c from '.././z-paging-constant'
import interceptor from '../z-paging-interceptor'
const language = uni.getSystemInfoSync().language;
export default {
data() {
return {
language
}
},
computed: {
finalLanguage() {
try {
const local = uni.getLocale();
const language = this.language;
const language = this.systemInfo.appLanguage;
return local === 'auto' ? interceptor._handleLanguage2Local(language, this._language2Local(language)) : local;
} catch (e) {
// 如果获取系统本地语言异常则默认返回中文uni.getLocale在部分低版本HX或者cli中可能报找不到的问题

View File

@ -179,12 +179,16 @@ export default {
// 是否显示自定义状态下的底部加载更多
showLoadingMoreCustom() {
return this._showLoadingMore('Custom');
}
},
// 底部加载更多固定高度
loadingMoreFixedHeight() {
return u.addUnit('80rpx', this.unit);
},
},
methods: {
// 页面滚动到底部时通知z-paging进行进一步处理
pageReachBottom() {
!this.useChatRecordMode && this._onLoadingMore('toBottom');
!this.useChatRecordMode && this.toBottomLoadingMoreEnabled && this._onLoadingMore('toBottom');
},
// 手动触发上拉加载更多(非必须,可依据具体需求使用)
doLoadMore(type) {
@ -240,7 +244,7 @@ export default {
}
}
},
// 触发加载更多时调用,from:toBottom-滑动到底部触发;1、click-点击加载更多触发
// 触发加载更多时调用,from:toBottom-滑动到底部触发;click-点击加载更多触发
_onLoadingMore(from = 'click') {
// 如果是ios并且是滚动到底部的则在滚动到底部时候尝试将列表设置为禁止滚动然后设置为允许滚动以禁止底部bounce的效果
if (this.isIos && from === 'toBottom' && !this.scrollToBottomBounceEnabled && this.scrollEnable) {
@ -250,7 +254,7 @@ export default {
})
}
// emit scrolltolower
this.$emit('scrolltolower', from);
this._emitScrollEvent('scrolltolower');
// 如果是只使用下拉刷新 或者 禁用底部加载更多 或者 底部加载更多不是默认状态或加载失败状态 或者 是加载中状态 或者 空数据图已经展示了则return不触发内部加载更多逻辑
if (this.refresherOnly || !this.loadingMoreEnabled || !(this.loadingStatus === Enum.More.Default || this.loadingStatus === Enum.More.Fail) || this.loading || this.showEmpty) return;
// #ifdef MP-WEIXIN
@ -275,15 +279,15 @@ export default {
// 如果是本地分页,则在组件内部对数据进行分页处理,不触发@query事件
this._localPagingQueryList(this.pageNo, this.defaultPageSize, this.localPagingLoadingTime, res => {
this.completeByTotal(res, this.totalLocalPagingList.length);
this.queryFrom = Enum.QueryFrom.LoadingMore;
this.queryFrom = Enum.QueryFrom.LoadMore;
})
} else {
// emit @query相关加载更多事件
this._emitQuery(this.pageNo, this.defaultPageSize, Enum.QueryFrom.LoadingMore);
this._emitQuery(this.pageNo, this.defaultPageSize, Enum.QueryFrom.LoadMore);
this._callMyParentQuery();
}
// 设置当前加载状态为底部加载更多状态
this.loadingType = Enum.LoadingType.LoadingMore;
this.loadingType = Enum.LoadingType.LoadMore;
}
},
// (预处理)判断当没有更多数据且分页内容未超出z-paging时是否显示没有更多数据的view

View File

@ -66,7 +66,7 @@ export default {
nLoadingMoreFixedHeight: false,
nShowRefresherRevealHeight: 0,
nOldShowRefresherRevealHeight: -1,
nRefresherWidth: uni.upx2px(750),
nRefresherWidth: u.rpx2px(750),
nF2Opacity: 0
}
},
@ -138,6 +138,19 @@ export default {
// 列表滚动结束
_nOnScrollend(e) {
this.$emit('scrollend', e);
// 判断是否滚动到顶部了
if (e?.contentOffset?.y >= 0) {
this._emitScrollEvent('scrolltoupper');
}
// 判断是否滚动到底部了
this._getNodeClientRect('.zp-n-list').then(node => {
if (node) {
if (e?.contentSize?.height + e?.contentOffset?.y <= node[0].height) {
this._emitScrollEvent('scrolltolower');
}
}
})
},
// 下拉刷新刷新中
_nOnRrefresh() {

View File

@ -349,7 +349,7 @@ export default {
return this.refresherTriggered;
},
showRefresher() {
const showRefresher = this.finalRefresherEnabled && this.useCustomRefresher;
const showRefresher = this.finalRefresherEnabled || this.useCustomRefresher && !this.useChatRecordMode;
// #ifndef APP-NVUE
this.active && this.customRefresherHeight === -1 && showRefresher && this.updateCustomRefresherHeight();
// #endif
@ -405,7 +405,7 @@ export default {
this.isUserReload = !isUserPullDown;
this._startLoading(true);
this.refresherTriggered = true;
if(this.reloadWhenRefresh && isUserPullDown){
if (this.reloadWhenRefresh && isUserPullDown) {
this.useChatRecordMode ? this._onLoadingMore('click') : this._reload(false, false, isUserPullDown);
}
},
@ -439,7 +439,7 @@ export default {
this._cleanRefresherEndTimeout();
},
// 非appvue或微信小程序或QQ小程序或h5平台使用js控制下拉刷新
// 非app-vue或微信小程序或QQ小程序或h5平台使用js控制下拉刷新
// #ifndef APP-VUE || MP-WEIXIN || MP-QQ || H5
// touch中
_refresherTouchmove(e) {
@ -615,7 +615,9 @@ export default {
// 下拉刷新结束
_refresherEnd(shouldEndLoadingDelay = true, fromAddData = false, isUserPullDown = false, setLoading = true) {
if (this.loadingType === Enum.LoadingType.Refresher) {
// 计算当前下拉刷新结束需要延迟的时间
const refresherCompleteDelay = (fromAddData && (isUserPullDown || this.showRefresherWhenReload)) ? this.refresherCompleteDelay : 0;
// 如果延迟时间大于0则展示刷新结束状态否则直接展示默认状态
const refresherStatus = refresherCompleteDelay > 0 ? Enum.Refresher.Complete : Enum.Refresher.Default;
if (this.finalShowRefresherWhenReload) {
const stackCount = this.refresherRevealStackCount;
@ -624,7 +626,12 @@ export default {
}
this._cleanRefresherEndTimeout();
this.refresherEndTimeout = u.delay(() => {
// 更新下拉刷新状态
this.refresherStatus = refresherStatus;
// 如果当前下拉刷新状态不是刷新结束,则认为其不在刷新结束状态
if (refresherStatus !== Enum.Refresher.Complete) {
this.isRefresherInComplete = false;
}
}, this.refresherStatus !== Enum.Refresher.Default && refresherStatus === Enum.Refresher.Default ? this.refresherCompleteDuration : 0);
// #ifndef APP-NVUE
@ -762,7 +769,7 @@ export default {
},
// 触发下拉刷新
_doRefresherLoad(isUserPullDown = true) {
this._onRefresh(false,isUserPullDown);
this._onRefresh(false, isUserPullDown);
this.loading = true;
},
// #ifndef APP-VUE || MP-WEIXIN || MP-QQ || H5

View File

@ -53,6 +53,8 @@ export default {
return {
scrollTop: 0,
oldScrollTop: 0,
scrollLeft: 0,
oldScrollLeft: 0,
scrollViewStyle: {},
scrollViewContainerStyle: {},
scrollViewInStyle: {},
@ -166,17 +168,24 @@ export default {
this._scrollIntoViewByNodeTop(nodeTop, offset, animate);
})
},
// 滚动到指定位置(vue中有效)。y为与顶部的距离单位为pxoffset为偏移量单位为pxanimate为是否展示滚动动画默认为否
// y轴滚动到指定位置(vue中有效)。y为与顶部的距离单位为pxoffset为偏移量单位为pxanimate为是否展示滚动动画默认为否
scrollToY(y, offset, animate) {
this.scrollTop = this.oldScrollTop;
this.$nextTick(() => {
this._scrollToY(y, offset, animate);
})
},
// x轴滚动到指定位置(非页面滚动且在vue中有效)。x为与左侧的距离单位为pxoffset为偏移量单位为pxanimate为是否展示滚动动画默认为否
scrollToX(x, offset, animate) {
this.scrollLeft = this.oldScrollLeft;
this.$nextTick(() => {
this._scrollToX(x, offset, animate);
})
},
// 滚动到指定view(nvue中和虚拟列表中有效)。index为需要滚动的view的index(第几个从0开始)offset为偏移量单位为pxanimate为是否展示滚动动画默认为否
scrollIntoViewByIndex(index, offset, animate) {
if (index >= this.realTotalData.length) {
u.consoleErr('当前滚动的index超出已渲染列表长度请先通过refreshToPage加载到对应index页并等待渲染成功后再调用此方法')
u.consoleErr('当前滚动的index超出已渲染列表长度请先通过refreshToPage加载到对应index页并等待渲染成功后再调用此方法');
return;
}
this.$nextTick(() => {
@ -232,7 +241,7 @@ export default {
// 当滚动到顶部时
_onScrollToUpper() {
this.$emit('scrolltoupper');
this._emitScrollEvent('scrolltoupper');
this.$emit('scrollTopChange', 0);
this.$nextTick(() => {
this.oldScrollTop = 0;
@ -240,7 +249,9 @@ export default {
},
// 当滚动到底部时
_onScrollToLower(e) {
(!e.detail || !e.detail.direction || e.detail.direction === 'bottom') && this._onLoadingMore(this.useChatRecordMode ? 'click' : 'toBottom')
(!e.detail || !e.detail.direction || e.detail.direction === 'bottom')
&& this.toBottomLoadingMoreEnabled
&& this._onLoadingMore(this.useChatRecordMode ? 'click' : 'toBottom')
},
// 滚动到顶部
_scrollToTop(animate = true, isPrivate = true) {
@ -379,7 +390,7 @@ export default {
this._scrollToY(nodeTop, offset, animate, true);
}
},
// 滚动到指定位置
// y轴滚动到指定位置
_scrollToY(y, offset = 0, animate = false, addScrollTop = false) {
this._updatePrivateScrollWithAnimation(animate);
u.delay(() => {
@ -400,19 +411,40 @@ export default {
}
}, 10)
},
// x轴滚动到指定位置
_scrollToX(x, offset = 0, animate = false) {
this._updatePrivateScrollWithAnimation(animate);
u.delay(() => {
if (!this.usePageScroll) {
this.scrollLeft = x - offset;
} else {
u.consoleErr('使用页面滚动时不支持scrollToX');
}
}, 10)
},
// scroll-view滚动中
_scroll(e) {
this.$emit('scroll', e);
const scrollTop = e.detail.scrollTop;
const { scrollTop, scrollLeft } = e.detail;
// #ifndef APP-NVUE
this.finalUseVirtualList && this._updateVirtualScroll(scrollTop, this.oldScrollTop - scrollTop);
// #endif
this.oldScrollTop = scrollTop;
this.oldScrollLeft = scrollLeft;
// 滚动区域内容的总高度 - 当前滚动的scrollTop = 当前滚动区域的顶部与内容底部的距离
const scrollDiff = e.detail.scrollHeight - this.oldScrollTop;
// 在非ios平台滚动中再次验证一下是否滚动到了底部。因为在一些安卓设备中有概率滚动到底部不触发@scrolltolower事件因此添加双重检测逻辑
!this.isIos && this._checkScrolledToBottom(scrollDiff);
},
// emit scrolltolower/scrolltoupper事件
_emitScrollEvent(type) {
const reversedType = type === 'scrolltolower' ? 'scrolltoupper' : 'scrolltolower';
const eventType = this.useChatRecordMode && !this.isChatRecordModeAndNotInversion
? reversedType
: type;
this.$emit(eventType);
},
// 更新内置的scroll-view是否启用滚动动画
_updatePrivateScrollWithAnimation(animate) {
this.privateScrollWithAnimation = animate ? 1 : 0;

View File

@ -74,6 +74,17 @@ export default {
type: [Number, String],
default: u.gc('virtualScrollFps', 80)
},
// 虚拟列表cell id的前缀适用于一个页面有多个虚拟列表的情况用以区分不同虚拟列表cell的id注意请勿传数字或以数字开头的字符串。如设置为list1则cell的id应为list1-zp-id-${item.zp_index}
virtualCellIdPrefix: {
type: String,
default: u.gc('virtualCellIdPrefix', '')
},
// 虚拟列表是否使用swiper-item包裹默认为否此属性为了解决vue3+(微信小程序或QQ小程序)中使用非内置列表写法时若z-paging在swiper-item内存在无法获取slot插入的cell高度进而导致虚拟列表失败的问题
// 仅vue3+(微信小程序或QQ小程序)+非内置列表写法虚拟列表有效其他情况此属性设置任何值都无效所以如果您在swiper-item内使用z-paging的非内置虚拟列表写法将此属性设置为true即可
virtualInSwiperSlot: {
type: Boolean,
default: false
},
},
data() {
return {
@ -110,6 +121,10 @@ export default {
virtualList(newVal){
this.$emit('update:virtualList', newVal);
this.$emit('virtualListChange', newVal);
},
// 监听虚拟列表顶部占位高度改变并emit
virtualPlaceholderTopHeight(newVal) {
this.$emit('virtualTopHeightChange', newVal);
}
},
computed: {
@ -139,17 +154,31 @@ export default {
finalFixedCellHeight() {
return u.convertToPx(this.fixedCellHeight);
},
fianlVirtualCellIdPrefix() {
const prefix = this.virtualCellIdPrefix ? this.virtualCellIdPrefix + '-' : '';
return prefix + 'zp-id';
},
finalPlaceholderTopHeightStyle() {
// #ifdef VUE2
return { transform: this.virtualPlaceholderTopHeight > 0 ? `translateY(${this.virtualPlaceholderTopHeight}px)` : 'none' };
// #endif
return {};
},
virtualRangePageHeight(){
return this.finalVirtualPageHeight * this.preloadPage;
},
virtualScrollDisTimeStamp() {
return 1000 / this.virtualScrollFps;
},
}
},
methods: {
// 在使用动态高度虚拟列表时若在列表数组中需要插入某个item需要调用此方法item:需要插入的itemindex:插入的cell位置若index为2则插入的item在原list的index=1之后index从0开始
doInsertVirtualListItem(item, index) {
if (this.cellHeightMode !== Enum.CellHeightMode.Dynamic) return;
this.realTotalData.splice(index, 0, item);
// #ifdef VUE3
this.realTotalData = [...this.realTotalData];
// #endif
this.virtualItemInsertedCount ++;
if (!item || Object.prototype.toString.call(item) !== '[object Object]') {
item = { item };
@ -162,7 +191,7 @@ export default {
while (retryCount <= 10) {
await u.wait(c.delayTime);
const cellNode = await this._getNodeClientRect(`#zp-id-${item[cellIndexKey]}`, this.finalUseInnerList);
const cellNode = await this._getVirtualCellNodeByIndex(item[cellIndexKey]);
// 如果获取当前cell的节点信息失败则重试不超过10次
if (!cellNode) {
retryCount ++;
@ -191,12 +220,12 @@ export default {
}
})
},
// 在使用动态高度虚拟列表时手动更新指定cell的缓存高度(当cell高度在初始化之后再次改变调用)index:需要更新的cell在列表中的位置从0开始
// 在使用动态高度虚拟列表时手动更新指定cell的缓存高度(当cell高度在初始化之后再次改变调用)index:需要更新的cell在列表中的位置从0开始
didUpdateVirtualListCell(index) {
if (this.cellHeightMode !== Enum.CellHeightMode.Dynamic) return;
const currentNode = this.virtualHeightCacheList[index];
this.$nextTick(() => {
this._getNodeClientRect(`#zp-id-${index}`, this.finalUseInnerList).then(cellNode => {
this._getVirtualCellNodeByIndex(index).then(cellNode => {
// 更新当前cell的高度
const cellNodeHeight = cellNode ? cellNode[0].height : 0;
const heightDis = cellNodeHeight - currentNode.height;
@ -261,7 +290,7 @@ export default {
if (!this.finalFixedCellHeight) {
this.$nextTick(() => {
u.delay(() => {
this._getNodeClientRect(`#zp-id-${0}`,this.finalUseInnerList).then(cellNode => {
this._getVirtualCellNodeByIndex(0).then(cellNode => {
if (!cellNode) {
if (this.getCellHeightRetryCount.fixed > 10) return;
this.getCellHeightRetryCount.fixed ++;
@ -287,7 +316,7 @@ export default {
this.$nextTick(() => {
u.delay(async () => {
for (let i = 0; i < list.length; i++) {
const cellNode = await this._getNodeClientRect(`#zp-id-${list[i][this.virtualCellIndexKey]}`, this.finalUseInnerList);
const cellNode = await this._getVirtualCellNodeByIndex(list[i][this.virtualCellIndexKey]);
const currentHeight = cellNode ? cellNode[0].height : 0;
if (!cellNode) {
if (this.getCellHeightRetryCount.dynamic <= 10) {
@ -328,8 +357,8 @@ export default {
_setCellIndex(list, dataFrom = 'bottom') {
let currentItemIndex = 0;
const cellIndexKey = this.virtualCellIndexKey;
([Enum.QueryFrom.Refresh, Enum.QueryFrom.Reload].indexOf(this.queryFrom) >= 0) && this._resetDynamicListState();
if (this.totalData.length) {
dataFrom === 'bottom' && ([Enum.QueryFrom.Refresh, Enum.QueryFrom.Reload].indexOf(this.queryFrom) >= 0) && this._resetDynamicListState();
if (this.totalData.length && this.queryFrom !== Enum.QueryFrom.Refresh) {
if (dataFrom === 'bottom') {
currentItemIndex = this.realTotalData.length;
const lastItem = this.realTotalData.length ? this.realTotalData.slice(-1)[0] : null;
@ -504,6 +533,20 @@ export default {
})
}
},
// 获取对应index的虚拟列表cell节点信息
_getVirtualCellNodeByIndex(index) {
let inDom = this.finalUseInnerList;
// 在vue3+(微信小程序或QQ小程序)中使用非内置列表写法时若z-paging在swiper-item内存在无法获取slot插入的cell高度的问题
// 通过uni.createSelectorQuery().in(this.$parent)来解决此问题
// #ifdef VUE3
// #ifdef MP-WEIXIN || MP-QQ
if (this.forceCloseInnerList && this.virtualInSwiperSlot) {
inDom = this.$parent;
}
// #endif
// #endif
return this._getNodeClientRect(`#${this.fianlVirtualCellIdPrefix}-${index}`, inDom);
},
// 处理使用内置列表时点击了cell事件
_innerCellClick(item, index) {
this.$emit('innerCellClick', item, index);

View File

@ -2,7 +2,7 @@
export default {
// 当前版本号
version: '2.7.11',
version: '2.8.6',
// 延迟操作的通用时间
delayTime: 100,
// 请求失败时候全局emit使用的key

View File

@ -1,32 +1,32 @@
// [z-paging]枚举
export default {
// 当前加载类型 0.下拉刷新 1.上拉加载更多
// 当前加载类型 refresher:下拉刷新 load-more:上拉加载更多
LoadingType: {
Refresher: 0,
LoadingMore: 1
Refresher: 'refresher',
LoadMore: 'load-more'
},
// 下拉刷新状态 0.默认状态 1.松手立即刷新 2.刷新中 3.刷新结束 4.松手进入二楼
// 下拉刷新状态 default:默认状态 release-to-refresh:松手立即刷新 loading:刷新中 complete:刷新结束 go-f2:松手进入二楼
Refresher: {
Default: 0,
ReleaseToRefresh: 1,
Loading: 2,
Complete: 3,
GoF2: 4
Default: 'default',
ReleaseToRefresh: 'release-to-refresh',
Loading: 'loading',
Complete: 'complete',
GoF2: 'go-f2'
},
// 底部加载更多状态 0.默认状态 1.加载中 2.没有更多数据 3.加载失败
// 底部加载更多状态 default:默认状态 loading:加载中 no-more:没有更多数据 fail:加载失败
More: {
Default: 0,
Loading: 1,
NoMore: 2,
Fail: 3
Default: 'default',
Loading: 'loading',
NoMore: 'no-more',
Fail: 'fail'
},
// @query触发来源 0.用户主动下拉刷新 1.通过reload触发 2.通过refresh触发 3.通过滚动到底部加载更多或点击底部加载更多触发
// @query触发来源 user-pull-down:用户主动下拉刷新 reload:通过reload触发 refresh:通过refresh触发 load-more:通过滚动到底部加载更多或点击底部加载更多触发
QueryFrom: {
UserPullDown: 0,
Reload: 1,
Refresh: 2,
LoadingMore: 3
UserPullDown: 'user-pull-down',
Reload: 'reload',
Refresh: 'refresh',
LoadMore: 'load-more'
},
// 虚拟列表cell高度模式
CellHeightMode: {

View File

@ -24,8 +24,7 @@ import virtualListModule from './modules/virtual-list'
import Enum from './z-paging-enum'
const systemInfo = uni.getSystemInfoSync();
const systemInfo = u.getSystemInfoSync();
export default {
name: "z-paging",
components: {
@ -50,8 +49,6 @@ export default {
data() {
return {
// --------------静态资源---------------
base64Arrow: zStatic.base64Arrow,
base64Flower: zStatic.base64Flower,
base64BackToTop: zStatic.base64BackToTop,
// -------------全局数据相关--------------
@ -216,9 +213,12 @@ export default {
// #endif
this.$nextTick(() => {
// 初始化systemInfo
this.systemInfo = uni.getSystemInfoSync();
this.systemInfo = u.getSystemInfoSync();
// 初始化z-paging高度
!this.usePageScroll && this.autoHeight && this._setAutoHeight();
!this.usePageScroll && this.autoHeight && this._setAutoHeight();
// #ifdef MP-KUAISHOU
this._setFullScrollViewInHeight();
// #endif
this.loaded = true;
u.delay(() => {
// 更新fixed模式下z-paging的布局主要是更新windowTop、windowBottom
@ -408,10 +408,7 @@ export default {
},
// 设置z-paging高度
async _setAutoHeight(shouldFullHeight = true, scrollViewNode = null) {
let heightKey = 'min-height';
// #ifndef APP-NVUE
heightKey = 'min-height';
// #endif
const heightKey = 'min-height';
try {
if (shouldFullHeight) {
// 如果需要铺满全屏,则计算当前全屏可是区域的高度
@ -422,7 +419,12 @@ export default {
let scrollViewHeight = this.windowHeight - scrollViewTop;
scrollViewHeight -= finalScrollBottomNode ? finalScrollBottomNode[0].height : 0;
const additionHeight = u.convertToPx(this.autoHeightAddition);
const finalHeight = scrollViewHeight + additionHeight - (this.insideMore ? 1 : 0) + 'px !important';
// 在支付宝小程序中,添加!important会导致min-height失效因此在支付宝小程序中需要去掉
let importantSuffix = ' !important';
// #ifdef MP-ALIPAY
importantSuffix = '';
// #endif
const finalHeight = scrollViewHeight + additionHeight - (this.insideMore ? 1 : 0) + 'px' + importantSuffix;
this.$set(this.scrollViewStyle, heightKey, finalHeight);
this.$set(this.scrollViewInStyle, heightKey, finalHeight);
}
@ -432,6 +434,16 @@ export default {
}
} catch (e) {}
},
// #ifdef MP-KUAISHOU
// 设置scroll-view内容器的最小高度等于scroll-view的高度(为了解决在快手小程序中内容较少时scroll-view内容器高度无法铺满scroll-view的问题)
async _setFullScrollViewInHeight() {
try {
// 如果需要铺满全屏,则计算当前全屏可是区域的高度
const scrollViewNode = await this._getNodeClientRect('.zp-scroll-view');
scrollViewNode && this.$set(this.scrollViewInStyle, 'min-height', scrollViewNode[0].height + 'px');
} catch (e) {}
},
// #endif
// 组件销毁后续处理
_handleUnmounted() {
this.active = false;

View File

@ -6,6 +6,7 @@ import c from './z-paging-constant'
const storageKey = 'Z-PAGING-REFRESHER-TIME-STORAGE-KEY';
let config = null;
let configLoaded = false;
let cachedSystemInfo = null;
const timeoutMap = {};
// 获取默认配置信息
@ -119,12 +120,41 @@ function convertToPx(text) {
text = text.replace('px', '');
}
if (!isNaN(text)) {
if (isRpx) return Number(uni.upx2px(text));
if (isRpx) return Number(rpx2px(text));
return Number(text);
}
return 0;
}
// rpx => px预留的兼容处理
function rpx2px(rpx) {
return uni.upx2px(rpx);
}
// 同步获取系统信息,兼容不同平台
function getSystemInfoSync(useCache = false) {
if (useCache && cachedSystemInfo) {
return cachedSystemInfo;
}
// 目前只用到了deviceInfo、appBaseInfo和windowInfo中的信息因此仅整合这两个信息数据
const infoTypes = ['DeviceInfo', 'AppBaseInfo', 'WindowInfo'];
const { deviceInfo, appBaseInfo, windowInfo } = infoTypes.reduce((acc, key) => {
const method = `get${key}`;
if (uni[method] && uni.canIUse(method)) {
acc[key.charAt(0).toLowerCase() + key.slice(1)] = uni[method]();
}
return acc;
}, {});
// 如果deviceInfo、appBaseInfo和windowInfo都可以从各自专属的api中获取则整合它们的数据
if (deviceInfo && appBaseInfo && windowInfo) {
cachedSystemInfo = { ...deviceInfo, ...appBaseInfo, ...windowInfo };
} else {
// 使用uni.getSystemInfoSync兜底确保能获取到最终的系统信息
cachedSystemInfo = uni.getSystemInfoSync();
}
return cachedSystemInfo;
}
// 获取当前时间
function getTime() {
return (new Date()).getTime();
@ -132,12 +162,12 @@ function getTime() {
// 获取z-paging实例id随机生成10位数字+字母
function getInstanceId() {
const s = [];
const hexDigits = "0123456789abcdef";
for (let i = 0; i < 10; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
return s.join('') + getTime();
const s = [];
const hexDigits = "0123456789abcdef";
for (let i = 0; i < 10; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
return s.join('') + getTime();
}
// 等待一段时间
@ -192,8 +222,8 @@ function _handleDefaultConfig() {
}
// 将config中的短横线写法全部转为驼峰写法使得读取配置时可以直接通过key去匹配而非读取每个配置时候再去转减少不必要的性能开支
config = config ? Object.keys(config).reduce((result, key) => {
result[_toCamelCase(key)] = config[key];
return result;
result[_toCamelCase(key)] = config[key];
return result;
}, {}) : null;
configLoaded = true;
}
@ -247,7 +277,7 @@ function _toKebab(value) {
// 短横线转驼峰
function _toCamelCase(value) {
return value.replace(/-([a-z])/g, (_, group1) => group1.toUpperCase());
return value.replace(/-([a-z])/g, (_, group1) => group1.toUpperCase());
}
@ -266,5 +296,7 @@ export default {
wait,
isPromise,
addUnit,
deepCopy
deepCopy,
rpx2px,
getSystemInfoSync
};

View File

@ -4,13 +4,13 @@
/ /_____| |_) | (_| | (_| | | | | | (_| |
/___| | .__/ \__,_|\__, |_|_| |_|\__, |
|_| |___/ |___/
v2.7.11 (2024-06-28)
by ZXLee
v2.8.6 (2025-03-17)
@author ZXLee <admin@zxlee.cn>
-->
<!-- 文档地址https://z-paging.zxlee.cn -->
<!-- github地址https://github.com/SmileZXLee/uni-z-paging -->
<!-- dcloud地址https://ext.dcloud.net.cn/plugin?id=3935 -->
<!-- 反馈QQ群790460711(已满)371624008 -->
<!-- 反馈QQ群343409055 -->
<template name="z-paging">
<!-- #ifndef APP-NVUE -->
@ -34,7 +34,7 @@ by ZXLee
<view :class="{'zp-scroll-view-container':true,'zp-absoulte':finalIsOldWebView}" :style="[scrollViewContainerStyle]">
<scroll-view
ref="zp-scroll-view" :class="{'zp-scroll-view':true,'zp-scroll-view-absolute':!usePageScroll,'zp-scroll-view-hide-scrollbar':!showScrollbar}" :style="[chatRecordRotateStyle]"
:scroll-top="scrollTop" :scroll-x="scrollX"
:scroll-top="scrollTop" :scroll-left="scrollLeft" :scroll-x="scrollX"
:scroll-y="finalScrollable" :enable-back-to-top="finalEnableBackToTop"
:show-scrollbar="showScrollbar" :scroll-with-animation="finalScrollWithAnimation"
:scroll-into-view="scrollIntoView" :lower-threshold="finalLowerThreshold" :upper-threshold="5"
@ -77,7 +77,7 @@ by ZXLee
<slot v-if="zSlots.refresherComplete&&refresherStatus===R.Complete" name="refresherComplete" />
<slot v-else-if="zSlots.refresherF2&&refresherStatus===R.GoF2" name="refresherF2" />
<z-paging-refresh ref="refresh" v-else-if="!showCustomRefresher" class="zp-custom-refresher-refresh" :style="[{'height': `${finalRefresherThreshold - finalRefresherThresholdPlaceholder}px`}]" :status="refresherStatus"
:defaultThemeStyle="finalRefresherThemeStyle" :defaultText="finalRefresherDefaultText"
:defaultThemeStyle="finalRefresherThemeStyle" :defaultText="finalRefresherDefaultText" :isIos="isIos"
:pullingText="finalRefresherPullingText" :refreshingText="finalRefresherRefreshingText" :completeText="finalRefresherCompleteText" :goF2Text="finalRefresherGoF2Text"
:defaultImg="refresherDefaultImg" :pullingImg="refresherPullingImg" :refreshingImg="refresherRefreshingImg" :completeImg="refresherCompleteImg" :refreshingAnimated="refresherRefreshingAnimated"
:showUpdateTime="showRefresherUpdateTime" :updateTimeKey="refresherUpdateTimeKey" :updateTimeTextMap="finalRefresherUpdateTimeTextMap"
@ -88,15 +88,19 @@ by ZXLee
<!-- 全屏Loading -->
<slot v-if="showLoading&&zSlots.loading&&!loadingFullFixed" name="loading" />
<!-- 主体内容 -->
<view class="zp-paging-container-content" :style="[{transform:virtualPlaceholderTopHeight>0?`translateY(${virtualPlaceholderTopHeight}px)`:'none'},finalPagingContentStyle]">
<view class="zp-paging-container-content" :style="[finalPlaceholderTopHeightStyle,finalPagingContentStyle]">
<!-- #ifdef VUE3 -->
<!-- 虚拟列表顶部占位view -->
<view v-if="useVirtualList" class="zp-virtual-placeholder" :style="[{height:virtualPlaceholderTopHeight+'px'}]"/>
<!-- #endif -->
<slot />
<!-- 内置列表&虚拟列表 -->
<template v-if="finalUseInnerList">
<slot name="header"/>
<view class="zp-list-container" :style="[innerListStyle]">
<template v-if="finalUseVirtualList">
<view class="zp-list-cell" :style="[innerCellStyle]" :id="`zp-id-${item[virtualCellIndexKey]}`" v-for="(item,index) in virtualList" :key="item['zp_unique_index']" @click="_innerCellClick(item,virtualTopRangeIndex+index)">
<view v-if="useCompatibilityMode">使z-paging.vue99</view>
<view class="zp-list-cell" :style="[innerCellStyle]" :id="`${fianlVirtualCellIdPrefix}-${item[virtualCellIndexKey]}`" v-for="(item,index) in virtualList" :key="item['zp_unique_index']" @click="_innerCellClick(item,virtualTopRangeIndex+index)">
<view v-if="useCompatibilityMode">使z-paging.vue103</view>
<!-- <zp-public-virtual-cell v-if="useCompatibilityMode" :extraData="extraData" :item="item" :index="virtualTopRangeIndex+index" /> -->
<slot v-else name="cell" :item="item" :index="virtualTopRangeIndex+index"/>
</view>
@ -170,7 +174,7 @@ by ZXLee
<!-- 点击返回顶部view -->
<view v-if="showBackToTopClass" :class="finalBackToTopClass" :style="[finalBackToTopStyle]" @click.stop="_backToTopClick">
<slot v-if="zSlots.backToTop" name="backToTop" />
<image v-else class="zp-back-to-top-img" :src="backToTopImg.length?backToTopImg:base64BackToTop" />
<image v-else class="zp-back-to-top-img" :class="{'zp-back-to-top-img-inversion': useChatRecordMode&&!backToTopImg.length}" :src="backToTopImg.length?backToTopImg:base64BackToTop" />
</view>
<!-- 全屏Loading(铺满z-paging并固定) -->
<view v-if="showLoading&&zSlots.loading&&loadingFullFixed" class="zp-loading-fixed">
@ -209,7 +213,7 @@ by ZXLee
<slot v-if="zSlots.refresherComplete&&refresherStatus===R.Complete" name="refresherComplete" />
<slot v-else-if="zSlots.refresherF2&&refresherStatus===R.GoF2" name="refresherF2" />
<slot v-else-if="(nScopedSlots?nScopedSlots:zSlots).refresher" :refresherStatus="refresherStatus" name="refresher" />
<z-paging-refresh ref="refresh" v-else :status="refresherStatus" :defaultThemeStyle="finalRefresherThemeStyle"
<z-paging-refresh ref="refresh" v-else :status="refresherStatus" :defaultThemeStyle="finalRefresherThemeStyle" :isIos="isIos"
:defaultText="finalRefresherDefaultText" :pullingText="finalRefresherPullingText" :refreshingText="finalRefresherRefreshingText" :completeText="finalRefresherCompleteText" :goF2Text="finalRefresherGoF2Text"
:defaultImg="refresherDefaultImg" :pullingImg="refresherPullingImg" :refreshingImg="refresherRefreshingImg" :completeImg="refresherCompleteImg" :refreshingAnimated="refresherRefreshingAnimated"
:showUpdateTime="showRefresherUpdateTime" :updateTimeKey="refresherUpdateTimeKey" :updateTimeTextMap="finalRefresherUpdateTimeTextMap"
@ -223,7 +227,7 @@ by ZXLee
<slot v-if="zSlots.refresherComplete&&refresherStatus===R.Complete" name="refresherComplete" />
<slot v-else-if="zSlots.refresherF2&&refresherStatus===R.GoF2" name="refresherF2" />
<slot v-else-if="(nScopedSlots?nScopedSlots:$slots).refresher" :refresherStatus="R.Loading" name="refresher" />
<z-paging-refresh ref="refresh" v-else :status="R.Loading" :defaultThemeStyle="finalRefresherThemeStyle"
<z-paging-refresh ref="refresh" v-else :status="R.Loading" :defaultThemeStyle="finalRefresherThemeStyle" :isIos="isIos"
:defaultText="finalRefresherDefaultText" :pullingText="finalRefresherPullingText" :refreshingText="finalRefresherRefreshingText" :completeText="finalRefresherCompleteText" :goF2Text="finalRefresherGoF2Text"
:defaultImg="refresherDefaultImg" :pullingImg="refresherPullingImg" :refreshingImg="refresherRefreshingImg" :completeImg="refresherCompleteImg" :refreshingAnimated="refresherRefreshingAnimated"
:showUpdateTime="showRefresherUpdateTime" :updateTimeKey="refresherUpdateTimeKey" :updateTimeTextMap="finalRefresherUpdateTimeTextMap"
@ -261,7 +265,7 @@ by ZXLee
</view>
</template>
<view :style="nLoadingMoreFixedHeight?{height:loadingMoreCustomStyle&&loadingMoreCustomStyle.height?loadingMoreCustomStyle.height:'80rpx'}:{}">
<view :style="nLoadingMoreFixedHeight?{height:loadingMoreCustomStyle&&loadingMoreCustomStyle.height?loadingMoreCustomStyle.height:loadingMoreFixedHeight}:{}">
<slot v-if="showLoadingMoreDefault" name="loadingMoreDefault" />
<slot v-else-if="showLoadingMoreLoading" name="loadingMoreLoading" />
<slot v-else-if="showLoadingMoreNoMore" name="loadingMoreNoMore" />
@ -280,7 +284,7 @@ by ZXLee
@reload="_emptyViewReload" @viewClick="_emptyViewClick" />
</view>
</component>
<component is="header" v-if="!hideNvueBottomTag" ref="zp-n-list-bottom-tag" class="zp-n-list-bottom-tag"></component>
<component :is="nViewIs" v-if="!hideNvueBottomTag" ref="zp-n-list-bottom-tag" class="zp-n-list-bottom-tag"></component>
</component>
<view v-if="zSlots.right" class="zp-page-right">
<slot name="right" />
@ -298,7 +302,7 @@ by ZXLee
<!-- 点击返回顶部view -->
<view v-if="showBackToTopClass" :class="finalBackToTopClass" :style="[finalBackToTopStyle]" @click.stop="_backToTopClick">
<slot v-if="zSlots.backToTop" name="backToTop" />
<image v-else class="zp-back-to-top-img" :src="backToTopImg.length?backToTopImg:base64BackToTop" />
<image v-else class="zp-back-to-top-img" :class="{'zp-back-to-top-img-inversion': useChatRecordMode&&!backToTopImg.length}" :src="backToTopImg.length?backToTopImg:base64BackToTop" />
</view>
<!-- 全屏Loading(铺满z-paging并固定) -->
<view v-if="showLoading&&zSlots.loading&&loadingFullFixed" class="zp-loading-fixed">
@ -307,27 +311,211 @@ by ZXLee
</component>
<!-- #endif -->
</template>
<!-- #ifdef APP-VUE || MP-WEIXIN || MP-QQ || H5 -->
<script src="./wxs/z-paging-wxs.wxs" module="pagingWxs" lang="wxs"></script>
<!-- #endif -->
<script module="pagingRenderjs" lang="renderjs">
import pagingRenderjs from './wxs/z-paging-renderjs.js';
/**
* z-paging 分页组件
* @description 高性能全平台兼容支持虚拟列表支持nvuevue3
* @description z-paging 分页组件高性能全平台兼容支持自定义下拉刷新上拉加载更多虚拟列表下拉进入二楼自动管理空数据图全自动分页无闪动聊天分页本地分页等也支持作为基本布局容器使用
* @tutorial https://z-paging.zxlee.cn
* @notice 以下仅为部分常用属性方法和事件完整文档请查阅z-paging官网
* @property {Number|String} default-page-no 自定义初始的pageNo默认为1
* @property {Number|String} default-page-size 自定义pageSize默认为10
* @property {Object} paging-style 设置z-paging的style部分平台(如微信小程序)无法直接修改组件的style可使用此属性代替
* @property {Array} value 父组件v-model所绑定的list的值默认为[]
* @property {Number|String} defaultPageNo 自定义初始的pageNo默认为1
* @property {Number|String} defaultPageSize 自定义pageSize(每页显示多少条)默认为10
* @property {Boolean} fixed z-paging是否使用fixed布局默认为true
* @property {Boolean} safeAreaInsetBottom 是否开启底部安全区域适配默认为false
* @property {Boolean} useSafeAreaPlaceholder 开启底部安全区域适配后是否使用placeholder形式实现默认为false
* @property {Boolean} usePageScroll 使用页面滚动默认为false
* @property {Boolean} autoFullHeight 使用页面滚动时是否在不满屏时自动填充满屏幕默认为true
* @property {String} defaultThemeStyle loading(下拉刷新上拉加载更多)的主题样式支持blackwhite默认为black
* @property {Object} pagingStyle 设置z-paging的style部分平台(如微信小程序)无法直接修改组件的style可使用此属性代替
* @property {String} height z-paging的高度优先级低于pagingStyle中设置的height传字符串如100px100rpx100%
* @property {String} width z-paging的宽度优先级低于pagingStyle中设置的width传字符串如100px100rpx100%
* @property {Boolean} use-page-scroll 使用页面滚动默认为否
* @property {Boolean} use-virtual-list 是否使用虚拟列表默认为否
* @property {Boolean} fixed z-paging是否使用fixed布局若使用fixed布局则z-paging的父view无需固定高度z-paging高度默认为100%默认为是(当使用内置scroll-view滚动时有效)
* @property {Boolean} auto [z-paging]mounted后是否自动调用reload方法(mounted后自动调用接口)默认为是
* @property {Boolean} use-chat-record-mode 使用聊天记录模式默认为否
* @property {String} maxWidth z-paging的最大宽度优先级低于pagingStyle中设置的max-width默认为空
* @property {String} bgColor z-paging的背景色(为css中的background因此也可以设置渐变背景图片等)优先级低于pagingStyle中设置的background-color
* @property {Boolean} watchTouchDirectionChange 是否监听列表触摸方向改变默认为false
* @property {Number|String} delay 调用complete后延迟处理的时间单位为毫秒优先级高于min-delay默认为0
* @property {Number|String} minDelay 触发@query后最小延迟处理的时间单位为毫秒优先级低于delay默认为0
* @property {Boolean} callNetworkReject 请求失败是否触发reject默认为true
* @property {String} unit z-paging中默认布局的单位默认为rpx
* @property {Boolean} concat 自动拼接complete中传过来的数组默认为true
* @property {Number|String|Object} dataKey 为保证数据一致设置当前tab切换时的标识key并在complete中传递相同key若二者不一致则complete将不会生效
* @property {String} autowireListName 极简写法自动注入的list名可自动修改父view(包含ref="paging")中对应name的list值
* @property {String} autowireQueryName 极简写法自动注入的query名可自动调用父view(包含ref="paging")中的query方法
* @property {Function} fetch 极简写法获取分页数据Function功能与@query类似若设置了fetch则@query将不再触发
* @property {Object} fetchParams fetch的附加参数fetch配置后有效
* @property {Boolean} auto [z-paging]mounted后是否自动调用reload方法(mounted后自动调用接口)默认为true
* @property {Boolean} autoScrollToTopWhenReload reload时自动滚动到顶部默认为true
* @property {Boolean} autoCleanListWhenReload reload时立即自动清空原list默认为true
* @property {Boolean} showRefresherWhenReload 列表刷新时自动显示下拉刷新view默认为false
* @property {Boolean} showLoadingMoreWhenReload 列表刷新时自动显示加载更多view且为加载中状态默认为false
* @property {Boolean} createdReload 组件created时立即触发reload默认为false
* @property {Boolean} refresherEnabled 是否开启下拉刷新默认为true
* @property {Number|String} refresherThreshold 设置自定义下拉刷新阈值默认单位为px默认为80rpx
* @property {Boolean} useRefresherStatusBarPlaceholder 是否开启下拉刷新状态栏占位默认为false
* @property {Boolean} refresherOnly 是否只使用下拉刷新默认为false
* @property {Boolean} useCustomRefresher 是否使用自定义的下拉刷新默认为true
* @property {Boolean} reloadWhenRefresh 用户下拉刷新时是否触发reload方法默认为true
* @property {String} refresherThemeStyle 下拉刷新的主题样式支持blackwhite默认为black
* @property {Object} refresherImgStyle 自定义下拉刷新中左侧图标的样式
* @property {Object} refresherTitleStyle 自定义下拉刷新中右侧状态描述文字的样式
* @property {Object} refresherUpdateTimeStyle 自定义下拉刷新中右侧最后更新时间文字的样式
* @property {Boolean} watchRefresherTouchmove 是否实时监听下拉刷新中进度并通过@refresherTouchmove传递给父组件默认为false
* @property {Boolean} showRefresherUpdateTime 是否显示最后更新时间默认为false
* @property {String|Object} refresherDefaultText 自定义下拉刷新默认状态下的文字
* @property {String|Object} refresherPullingText 自定义下拉刷新松手立即刷新状态下的文字
* @property {String|Object} refresherRefreshingText 自定义下拉刷新刷新中状态下的文字
* @property {String|Object} refresherCompleteText 自定义下拉刷新刷新结束状态下的文字
* @property {String} refresherDefaultImg 自定义下拉刷新默认状态下的图片
* @property {String} refresherPullingImg 自定义下拉刷新松手立即刷新状态下的图片
* @property {String} refresherRefreshingImg 自定义下拉刷新刷新中状态下的图片
* @property {String} refresherCompleteImg 自定义下拉刷新刷新结束状态下的图片
* @property {Boolean} refresherRefreshingAnimated 自定义下拉刷新刷新中状态下是否展示旋转动画默认为true
* @property {Boolean} refresherEndBounceEnabled 是否开启自定义下拉刷新刷新结束回弹动画效果默认为true
* @property {String} refresherDefaultStyle 设置系统下拉刷新默认样式支持设置blackwhitenone默认为black
* @property {String} refresherBackground 设置自定义下拉刷新区域背景颜色默认为#FFFFFF00
* @property {String} refresherFixedBackground 设置固定的自定义下拉刷新区域背景颜色默认为#FFFFFF00
* @property {Number|String} refresherFixedBacHeight 设置固定的自定义下拉刷新区域高度默认为0
* @property {Number|String} refresherDefaultDuration 设置自定义下拉刷新默认状态下回弹动画时间单位为毫秒默认为100
* @property {Number|String} refresherCompleteDelay 自定义下拉刷新结束以后延迟收回的时间单位为毫秒默认为0
* @property {Number|String} refresherCompleteDuration 自定义下拉刷新结束收回动画时间单位为毫秒默认为300
* @property {Boolean} refresherVibrate 下拉刷新时下拉到松手立即刷新状态时是否使手机短振动默认为false
* @property {Boolean} refresherRefreshingScrollable 自定义下拉刷新刷新中状态是否允许列表滚动默认为true
* @property {Boolean} refresherCompleteScrollable 自定义下拉刷新结束状态下是否允许列表滚动默认为false
* @property {Number} refresherOutRate 设置自定义下拉刷新下拉超出阈值后继续下拉位移衰减的比例默认为0.65
* @property {Boolean} refresherF2Enabled 是否开启下拉进入二楼功能默认为false
* @property {Number|String} refresherF2Threshold 下拉进入二楼阈值默认为200rpx
* @property {Number|String} refresherF2Duration 下拉进入二楼动画时间单位为毫秒默认为200
* @property {Boolean} showRefresherF2 下拉进入二楼状态松手后是否弹出二楼默认为true
* @property {Number} refresherPullRate 设置自定义下拉刷新下拉时实际下拉位移与用户下拉距离的比值默认为0.75
* @property {Number|String} refresherFps 自定义下拉刷新下拉帧率默认为40
* @property {Number|String} refresherMaxAngle 自定义下拉刷新允许触发的最大下拉角度默认为40度
* @property {Boolean} refresherAngleEnableChangeContinued 自定义下拉刷新的角度由未达到最大角度变到达到最大角度时是否继续下拉刷新手势默认为false
* @property {Boolean} refresherNoTransform 下拉刷新时是否禁止下拉刷新view跟随用户触摸竖直移动默认为false
* @property {Boolean} loadingMoreEnabled 是否启用加载更多数据(含滑动到底部加载更多数据和点击加载更多数据)默认为true
* @property {Number|String} lowerThreshold 距底部/右边多远时触发scrolltolower事件默认单位为px默认为100rpx
* @property {Boolean} toBottomLoadingMoreEnabled 是否启用滑动到底部加载更多数据默认为true
* @property {String} loadingMoreThemeStyle 底部加载更多的主题样式支持blackwhite默认为black
* @property {Object} loadingMoreCustomStyle 自定义底部加载更多样式
* @property {Object} loadingMoreTitleCustomStyle 自定义底部加载更多文字样式
* @property {Object} loadingMoreLoadingIconCustomStyle 自定义底部加载更多加载中动画样式
* @property {String} loadingMoreLoadingIconType 自定义底部加载更多加载中动画图标类型可选flower或circle默认为flower
* @property {String} loadingMoreLoadingIconCustomImage 自定义底部加载更多加载中动画图标图片
* @property {Boolean} loadingMoreLoadingAnimated 底部加载更多加载中view是否展示旋转动画默认为true
* @property {String|Object} loadingMoreDefaultText 滑动到底部"默认"文字
* @property {String|Object} loadingMoreLoadingText 滑动到底部"加载中"文字
* @property {String|Object} loadingMoreNoMoreText 滑动到底部"没有更多"文字
* @property {String|Object} loadingMoreFailText 滑动到底部"加载失败"文字
* @property {Boolean} hideNoMoreInside 当没有更多数据且分页内容未超出z-paging时是否隐藏没有更多数据的view默认为false
* @property {Number} hideNoMoreByLimit 当没有更多数据且分页数组长度少于这个值时隐藏没有更多数据的view默认为0
* @property {Boolean} insideMore 当分页未满一屏时是否自动加载更多默认为false
* @property {Boolean} loadingMoreDefaultAsLoading 滑动到底部状态为默认状态时以加载中的状态展示默认为false
* @property {Boolean} showLoadingMoreNoMoreView 是否显示没有更多数据的view默认为true
* @property {Boolean} showDefaultLoadingMoreText 是否显示默认的加载更多text默认为true
* @property {Boolean} showLoadingMoreNoMoreLine 是否显示没有更多数据的分割线默认为true
* @property {Object} loadingMoreNoMoreLineCustomStyle 自定义底部没有更多数据的分割线样式
* @property {Boolean} hideEmptyView 是否强制隐藏空数据图默认为false
* @property {Boolean} emptyViewFixed 空数据图片是否铺满z-paging默认为false
* @property {Boolean} emptyViewCenter 空数据图片是否垂直居中默认为true
* @property {String|Object} emptyViewText 空数据图描述文字
* @property {String} emptyViewImg 空数据图图片
* @property {String} emptyViewErrorImg 空数据图加载失败图片
* @property {String|Object} emptyViewReloadText 空数据图点击重新加载文字
* @property {String|Object} emptyViewErrorText 空数据图加载失败描述文字
* @property {Object} emptyViewSuperStyle 空数据图父view样式
* @property {Object} emptyViewStyle 空数据图样式
* @property {Object} emptyViewImgStyle 空数据图img样式
* @property {Object} emptyViewTitleStyle 空数据图描述文字样式
* @property {Object} emptyViewReloadStyle 空数据图重新加载按钮样式
* @property {Boolean} showEmptyViewReload 是否显示空数据图重新加载按钮(无数据时)默认为false
* @property {Boolean} showEmptyViewReloadWhenError 加载失败时是否显示空数据图重新加载按钮默认为true
* @property {Boolean} autoHideEmptyViewWhenLoading 加载中时是否自动隐藏空数据图默认为true
* @property {Boolean} autoHideEmptyViewWhenPull 用户下拉列表触发下拉刷新加载中时是否自动隐藏空数据图默认为true
* @property {Boolean} autoHideLoadingAfterFirstLoaded 第一次加载后自动隐藏loading slot默认为true
* @property {Boolean} loadingFullFixed loading slot的父view是否铺满屏幕并固定默认为false
* @property {Boolean} autoShowSystemLoading 是否自动显示系统Loading即uni.showLoading默认为false
* @property {String|Object} systemLoadingText 显示系统Loading时显示的文字
* @property {Boolean} systemLoadingMask 显示系统Loading时是否显示透明蒙层防止触摸穿透默认为true
* @property {Boolean} autoShowBackToTop 自动显示点击返回顶部按钮默认为false
* @property {Number|String} backToTopThreshold 点击返回顶部按钮显示/隐藏的阈值(滚动距离)默认单位为px默认为400rpx
* @property {String} backToTopImg 点击返回顶部按钮的自定义图片地址
* @property {Boolean} backToTopWithAnimate 点击返回顶部按钮返回到顶部时是否展示过渡动画默认为true
* @property {Number|String} backToTopBottom 点击返回顶部按钮与底部的距离默认单位为px默认为160rpx
* @property {Object} backToTopStyle 点击返回顶部按钮的自定义样式
* @property {Boolean} useVirtualList 是否使用虚拟列表默认为false
* @property {Boolean} useCompatibilityMode 在使用虚拟列表时是否使用兼容模式默认为false
* @property {Object} extraData 使用兼容模式时传递的附加数据
* @property {String} cellHeightMode 虚拟列表cell高度模式默认为fixed
* @property {Number|String} preloadPage 预加载的列表可视范围(列表高度)页数默认为12
* @property {Number|String} fixedCellHeight 固定的cell高度`cell-height-mode=fixed`才有效默认为空
* @property {Number|String} virtualListCol 虚拟列表列数默认为1
* @property {Number|String} virtualScrollFps 虚拟列表scroll取样帧率默认为80
* @property {String} virtualCellIdPrefix 虚拟列表cell id的前缀
* @property {Boolean} useInnerList 是否在z-paging内部循环渲染列表(使用内置列表)默认为false
* @property {Boolean} forceCloseInnerList 强制关闭inner-list默认为false
* @property {Boolean} virtualInSwiperSlot 虚拟列表是否使用swiper-item包裹默认为false
* @property {String} cellKeyName 内置列表cell的key名称(仅nvue有效)
* @property {Object} innerListStyle innerList样式
* @property {Object} innerCellStyle innerCell样式
* @property {Number|String} localPagingLoadingTime 本地分页时上拉加载更多延迟时间单位为毫秒默认为200
* @property {Boolean} useChatRecordMode 使用聊天记录模式默认为false
* @property {Boolean} autoHideKeyboardWhenChat 使用聊天记录模式时是否自动隐藏键盘默认为true
* @property {Boolean} autoAdjustPositionWhenChat 使用聊天记录模式中键盘弹出时是否自动调整slot="bottom"高度默认为true
* @property {Boolean} autoToBottomWhenChat 使用聊天记录模式中键盘弹出时是否自动滚动到底部默认为false
* @property {String} chatAdjustPositionOffset 使用聊天记录模式中键盘弹出时占位高度偏移距离默认为0px
* @property {Boolean} showChatLoadingWhenReload 使用聊天记录模式中`reload`时是否显示`chatLoading`默认为false
* @property {String} bottomBgColor `bottom`的背景色默认透明
* @property {Boolean} chatLoadingMoreDefaultAsLoading 在聊天记录模式中滑动到顶部状态为默认状态时是否以加载中的状态展示默认为true
* @property {Boolean} showScrollbar 控制是否出现滚动条默认为true
* @property {Boolean} scrollable 是否可以滚动使用内置scroll-view和nvue时有效默认为true
* @property {Boolean} scrollX 是否允许横向滚动默认为false
* @property {Boolean} scrollToTopBounceEnabled iOS设备上滚动到顶部时是否允许回弹效果默认为false
* @property {Boolean} scrollToBottomBounceEnabled iOS设备上滚动到底部时是否允许回弹效果默认为true
* @property {Boolean} scrollWithAnimation 在设置滚动条位置时使用动画过渡默认为false
* @property {String} scrollIntoView 值应为某子元素idid不能以数字开头设置哪个方向可滚动则在哪个方向滚动到该元素
* @property {Boolean} enableBackToTop iOS点击顶部状态栏安卓双击标题栏时滚动条返回顶部默认为true
* @property {String} nvueListIs nvue中修改列表类型默认为list
* @property {Object} nvueWaterfallConfig waterfall配置仅在nvue中且nvueListIs=waterfall时有效
* @property {Boolean} nvueBounce nvue控制是否回弹效果iOS不支持动态修改默认为true
* @property {Boolean} nvueFastScroll nvue中通过代码滚动到顶部/底部时是否加快动画效果默认为false
* @property {String} nvueListId nvue中list的id
* @property {Boolean} hideNvueBottomTag 是否隐藏nvue列表底部的tagView默认为false
* @property {Boolean} nvuePagingEnabled 设置nvue中是否按分页模式(类似竖向swiper)显示List默认为false
* @property {Number} offsetAccuracy nvue中控制onscroll事件触发的频率默认为空
* @property {Boolean} useCache 是否使用缓存默认为false
* @property {String} cacheKey 使用缓存时缓存的key
* @property {String} cacheMode 缓存模式默认为default
* @property {Number} topZIndex slot="top"的view的z-index默认为99
* @property {Number} superContentZIndex z-paging内容容器父view的z-index默认为1
* @property {Number} contentZIndex z-paging内容容器部分的z-index默认为1
* @property {Number} emptyViewZIndex 空数据view的z-index默认为9
* @property {Boolean} autoHeight z-paging是否自动高度默认为false
* @property {Number|String} autoHeightAddition z-paging自动高度时的附加高度默认为0px
* @event {Function} input 父组件v-model所绑定的list的值改变时触发此事件
* @event {Function} query 下拉刷新或滚动到底部时会自动触发此方法z-paging加载时也会触发(若要禁止请设置:auto="false")pageNo和pageSize会自动计算好直接传给服务器即可
* @event {Function} listChange 分页渲染的数组改变时触发
* @event {Function} refresherStatusChange 自定义下拉刷新状态改变
* @event {Function} refresherTouchstart 自定义下拉刷新下拉开始
* @event {Function} refresherTouchmove 自定义下拉刷新下拉拖动中
* @event {Function} refresherTouchend 自定义下拉刷新下拉结束
* @event {Function} refresherF2Change 下拉进入二楼状态改变
* @event {Function} refresh 自定义下拉刷新被触发
* @event {Function} restore 自定义下拉刷新被复位
* @event {Function} loadingStatusChange 自定义下拉刷新状态改变
* @event {Function} emptyViewReload 点击了空数据图中的重新加载按钮
* @event {Function} emptyViewClick 点击了空数据图view
* @event {Function} isLoadFailedChange z-paging请求失败状态改变
* @event {Function} backToTopClick 点击了返回顶部按钮
* @event {Function} virtualListChange 虚拟列表当前渲染的数组改变时触发
* @event {Function} innerCellClick 使用虚拟列表或内置列表时点击了cell
* @event {Function} virtualPlaceholderTopHeight 虚拟列表顶部占位高度改变
* @event {Function} hidedKeyboard 在聊天记录模式下触摸列表隐藏了键盘
* @event {Function} keyboardHeightChange 键盘高度改变
* @event {Function} scroll z-paging列表滚动时触发
* @event {Function} scrollTopChange scrollTop改变时触发
* @event {Function} scrolltolower z-paging内置的scroll-view/list-view/waterfall滚动底部时触发
* @event {Function} scrolltoupper z-paging内置的scroll-view/list-view/waterfall滚动顶部时触发
* @event {Function} scrollend z-paging内置的list滚动结束时触发
* @event {Function} contentHeightChanged z-paging中内容高度改变时触发
* @event {Function} touchDirectionChange 监听列表触摸方向改变
* @example <z-paging ref="paging" v-model="dataList" @query="queryList"></z-paging>
*/
export default {
@ -337,7 +525,12 @@ by ZXLee
// #endif
}
</script>
<script src="./js/z-paging-main.js" />
<!-- #ifdef APP-VUE || MP-WEIXIN || MP-QQ || H5 -->
<script src="./wxs/z-paging-wxs.wxs" module="pagingWxs" lang="wxs"></script>
<!-- #endif -->
<style scoped>
@import "./css/z-paging-main.css";

View File

@ -1,723 +0,0 @@
type _Arrayable<T> = T | T[];
declare global {
/**
* z-paging
*
* @since 2.5.3
*/
interface ZPagingReturnData<T> {
/**
*
*/
totalList: T[];
/**
*
*/
noMore: boolean;
}
/**
* [list](https://uniapp.dcloud.net.cn/component/list.html)
*
* @since 2.0.4
*/
interface ZPagingSetSpecialEffectsArgs {
/**
* listidscroller
*/
id?: string;
/**
* headerscroller
* - Android
*
* @default 0
*/
headerHeight?: number;
}
/**
* z-paging
*/
interface ZPagingInstance<T = any> {
/**
* pageNo
*
* @param [animate=false]
*/
reload: (animate?: boolean) => Promise<ZPagingReturnData<T>>;
/**
* pageNopageSize
*
* @since 2.0.4
*/
refresh: () => Promise<ZPagingReturnData<T>>;
/**
*
*
* @since 2.5.9
* @param page
*/
refreshToPage: (page: number) => Promise<ZPagingReturnData<T>>;
/**
*
* - completepageSize
*
* @param [data]
* @param [success=true]
*/
complete: (data?: T[] | false, success?: boolean) => Promise<ZPagingReturnData<T>>;
/**
*
* - total
*
* @since 2.0.6
* @param data
* @param total
* @param [success=true]
*/
completeByTotal: (data: T[], total: number, success?: boolean) => Promise<ZPagingReturnData<T>>;
/**
*
* -
*
* @since 1.9.2
* @param data
* @param noMore
* @param [success=true]
*/
completeByNoMore: (data: T[], noMore: boolean, success?: boolean) => Promise<ZPagingReturnData<T>>;
/**
*
* - z-paging
*
* @since 2.6.3
* @param cause
*/
completeByError: (cause: string) => Promise<ZPagingReturnData<T>>;
/**
*
* -
*
* @since 1.6.4
* @param data
* @param key dataKey:data-key
* @param [success=true]
*/
completeByKey: (data: T[], key: string, success?: boolean) => Promise<ZPagingReturnData<T>>;
/**
* pageNo
*
* @since 2.1.0
*/
clear: () => void;
/**
* pageNopageSize
*
* @param data
* @param [scrollToTop=true] true
* @param [animate=true] 使
*/
addDataFromTop: (data: _Arrayable<T>, scrollToTop?: boolean, animate?: boolean) => void;
/**
* pageNopageSize
* - z-paging
*
* @param data
*/
resetTotalData: (data: T[]) => void;
/**
*
*
* @since 2.1.0
*/
endRefresh: () => void;
/**
* view
* - 使slot="refresher"view
*
* @since 2.6.1
*/
updateCustomRefresherHeight: () => void;
/**
*
*
* @since 2.7.7
*/
closeF2: () => void;
/**
*
* - 使z-pagingscroll-viewz-pagingonReachBottom
*
* @param [source]
*/
doLoadMore: (source?: "click" | "toBottom") => void;
/**
* 使onPageScrollz-pagingpageScrollTop
* - mixins
*
* @param scrollTop pageonPageScrollscrollTop
*/
updatePageScrollTop: (scrollTop: number) => void;
/**
* 使slot="top"使slot="top"view
*/
updatePageScrollTopHeight: () => void;
/**
* 使slot="bottom"使slot="bottom"view
*/
updatePageScrollBottomHeight: () => void;
/**
* slot="left"slot="right"slot="left"slot="right"
*
* @since 2.3.5
*/
updateLeftAndRightWidth: () => void;
/**
* fixedz-pagingonShowiOS+h5+tabbar+fixed+tabbartabbar
*
* @since 2.6.5
*/
updateFixedLayout: () => void;
/**
* 使item
*
* @since 2.5.9
* @param item
* @param index cell2itemlistindex=10
*/
doInsertVirtualListItem: (item: T, index: number) => void;
/**
* 使cell
* - cell
*
* @since 2.4.0
* @param index cell0
*/
didUpdateVirtualListCell: (index: number) => void;
/**
* 使item
*
* @since 2.4.0
* @param index cell0
*/
didDeleteVirtualListCell: (index: number) => void;
/**
*
*
* @since 2.7.10
*/
updateVirtualListRender: () => void;
/**
* ()z-paging
* - @query
*
* @param data
* @param [success=true]
*/
setLocalPaging: (data: T[], success?: boolean) => Promise<ZPagingReturnData<T>>;
/**
*
*/
doChatRecordLoadMore: () => void;
/**
* use-chat-record-modetrue
*
* @param data
* @param [scrollToBottom=true]
* @param [animate=true] 使
*/
addChatRecordData: (data: _Arrayable<T>, scrollToBottom?: boolean, animate?: boolean) => void;
/**
*
*
* @param [animate=true]
*/
scrollToTop: (animate?: boolean) => void;
/**
*
*
* @param [animate=true]
*/
scrollToBottom: (animate?: boolean) => void;
/**
* view
* - vue使scrollIntoViewByNodeTop
*
* @param id viewid"#"
* @param [offset=0] px
* @param [animate=false]
*/
scrollIntoViewById: (id: string, offset?: number, animate?: boolean) => void;
/**
* view
* - vue
*
* @since 1.7.4
* @param top viewtop(uni.createSelectorQuery())
* @param [offset=0] px
* @param [animate=false]
*/
scrollIntoViewByNodeTop: (top: number, offset?: number, animate?: boolean) => void;
/**
* view
* - vue
* - scrollIntoViewByNodeTopscrollToYviewtopscrollIntoViewByNodeToptopuni.createSelectorQuery()top
*
* @param top viewtoppx
* @param [offset=0] px
* @param [animate=false]
*/
scrollToY: (top: number, offset?: number, animate?: boolean) => void;
/**
* view
* - nvue
* - nvuecell :ref="`z-paging-${index}`"
*
* @param index viewindex()
* @param [offset=0] px
* @param [animate=false]
*/
scrollIntoViewByIndex: (index: number, offset?: number, animate?: boolean) => void;
/**
* view
* - nvue
*
* @param view view(this.$refs.xxx)
* @param [offset=0] px
* @param [animate=false]
*/
scrollIntoViewByView: (view: any, offset?: number, animate?: boolean) => void;
/**
* nvue ListspecialEffects
*
* @since 2.0.4
* @param args https://uniapp.dcloud.io/component/list?id=listsetspecialeffects
*/
setSpecialEffects: (args: ZPagingSetSpecialEffectsArgs) => void;
/**
* {@link setSpecialEffects}
*
* @since 2.0.4
*/
setListSpecialEffects: (args: ZPagingSetSpecialEffectsArgs) => void;
/**
* v-modellistpageSizelist
*
* @since 2.3.9
*/
updateCache: () => void;
/**
*
*/
getVersion: () => string;
}
/**
* z-paging
* - uni.$zp
*
* @since 2.6.5
*/
interface ZPagingGlobal {
/**
*
*/
config: Record<string, any>;
}
/**
*
*
* @since 2.7.7
*/
type ZPagingVirtualItem<T> = T & {
/**
*
*/
zp_index: number;
};
namespace ZPagingEvent {
/**
* query0. 1.reload 2.refresh 3.
*/
type _QueryFrom = 0 | 1 | 2 | 3;
/**
*
*
* @param pageNo
* @param pageSize
* @param from query0. 1.reload 2.refresh 3.
*/
interface Query {
(pageNo: number, pageSize: number, from: _QueryFrom): void;
}
/**
*
*
* @param list
*/
interface ListChange {
(list: []): void;
}
/**
* 0- 1. 2. 3.(:refresher-complete-delay="200")
*/
type _RefresherStatus = 0 | 1 | 2 | 3;
/**
*
* - use-custom-refresherfalse
*
* @param status 0- 1. 2. 3.(:refresher-complete-delay="200")
*/
interface RefresherStatusChange {
(status: _RefresherStatus): void;
}
/**
*
* - use-custom-refresherfalsenvue
*
* @param y y(px)
*/
interface RefresherTouchstart {
(y: number): void;
}
/**
* touchmove
*/
interface _RefresherTouchmoveInfo {
/** 下拉的距离 */
pullingDistance: number;
/** 前后两次回调滑动距离的差值 */
dy: number;
/** refresh组件高度 */
viewHeight: number;
/** pullingDistance/viewHeight的比值 */
rate: number;
}
/**
*
* - use-custom-refresherfalse
* - 使wxswxsjsz-paging@refresherTouchmovewxsjsQQ$listeners:watch-refresher-touchmove="true"使
*
* @param info touchmove
*/
interface RefresherTouchmove {
(info: _RefresherTouchmoveInfo): void;
}
/**
*
* - use-custom-refresherfalsenvue
*
* @param y y(px)
*/
interface RefresherTouchend {
(y: number): void;
}
/**
* go- close-
*/
type _RefresherF2ChangeStatus = 'go' | 'close';
/**
*
*
* @since 2.7.7
* @param status go- close-
*/
interface RefresherF2Change {
(status: _RefresherF2ChangeStatus): void;
}
/**
*
*/
interface OnRefresh {
(): void;
}
/**
*
*/
interface OnRestore {
(): void;
}
/**
* 0- 1. 2. 3.
*/
type _LoadingStatus = 0 | 1 | 2 | 3;
/**
*
*
* @param status 0- 1. 2. 3.
*/
interface LoadingStatusChange {
(status: _LoadingStatus): void;
}
/**
* reloadreloadhandler(false)
*/
type _EmptyViewReloadHandler = (value: boolean) => void;
/**
*
*
* @since 1.8.0
* @param handler reloadreloadhandler(false)
*/
interface EmptyViewReload {
(handler: _EmptyViewReloadHandler): void;
}
/**
* view
*
* @since 2.3.3
*/
interface EmptyViewClick {
(): void;
}
/**
*
*
* @since 2.5.0
* @param isLoadFailed true
*/
interface IsLoadFailedChange {
(isLoadFailed: boolean): void;
}
/**
* handler(false)
*/
type _BackToTopClickHandler = (value: boolean) => void;
/**
*
*
* @since 2.6.1
* @param handler handler(false)
*/
interface BackToTopClick {
(handler: _BackToTopClickHandler): void;
}
/**
* +
* -nvue
*
* @since 2.2.7
* @param list
*/
interface VirtualListChange {
(list: []): void;
}
/**
* 使cell
*/
interface _InnerCellClickInfo<T> {
/** 当前点击的item */
item: T;
/** 当前点击的index */
index: number;
}
/**
* 使cell
* -nvue
*
* @since 2.4.0
* @param info cell
*/
interface InnerCellClick {
(info: _InnerCellClickInfo<any>): void;
}
/**
*
*
* @since 2.3.6
*/
interface HidedKeyboard {
(): void;
}
/**
*
*/
interface _KeyboardHeightInfo {
/** 键盘的高度 */
height: number;
}
/**
*
* -uni.onKeyboardHeightChangez-pagingps:H5
*
* @since 2.7.1
* @param info
*/
interface KeyboardHeightChange {
(info: _KeyboardHeightInfo): void;
}
/**
* (vue)
*/
interface _ScrollInfo {
detail: {
scrollLeft: number;
scrollTop: number;
scrollHeight: number;
scrollWidth: number;
deltaX: number;
deltaY: number;
}
}
/**
* (nvue)
*/
interface _ScrollInfoN {
contentSize: {
width: number;
height: number;
};
contentOffset: {
x: number;
y: number;
};
isDragging: boolean;
}
/**
*
*
* @param event vue使_ScrollInfonvue使_ScrollInfoN
*/
interface Scroll {
(event: _ScrollInfo | _ScrollInfoN): void;
}
/**
* scrollTop使scrollTop使
*
* @param scrollTop
*/
interface ScrollTopChange {
(scrollTop: number): void;
}
/**
* scroll-view(toBottomclickview)
*/
type _ScrolltolowerFrom = 'toBottom' | 'click';
/**
* scroll-view
*
* @param from (toBottomclickview)
*/
interface Scrolltolower {
(from: _ScrolltolowerFrom): void;
}
/**
* scroll-view
*/
interface Scrolltoupper {
(): void;
}
/**
*
*/
interface _ScrollendEvent {
contentSize: {
width: number;
height: number;
};
contentOffset: {
x: number;
y: number;
};
isDragging: boolean;
}
/**
* list
* -nvue
*
* @since 2.7.3
* @param event
*/
interface Scrollend {
(event: _ScrollendEvent): void;
}
/**
* z-paging
*
* @since 2.1.3
* @param height
*/
interface ContentHeightChanged {
(height: number): void;
}
/**
* top(scrollTop)bottom(scrollTop)
*/
type _TouchDirection = 'top' | 'bottom';
/**
*
*
* @since 2.3.0
* @param direction top(scrollTop)bottom(scrollTop)
*/
interface TouchDirectionChange {
(direction: _TouchDirection): void;
}
}
}
export {};

View File

@ -2,8 +2,8 @@
"id": "z-paging",
"name": "z-paging",
"displayName": "【z-paging下拉刷新、上拉加载】高性能全平台兼容。支持虚拟列表分页全自动处理",
"version": "2.7.11",
"description": "超简单、低耦合使用wxs+renderjs实现。支持自定义下拉刷新、上拉加载更多、虚拟列表、下拉进入二楼、自动管理空数据图、无闪动聊天分页、本地分页、国际化等100+项配置",
"version": "2.8.6",
"description": "超简单、低耦合使用wxs+renderjs实现。支持自定义下拉刷新、上拉加载更多、虚拟列表、下拉进入二楼、自动管理空数据图、无闪动聊天分页、本地分页、国际化等数百项配置",
"keywords": [
"下拉刷新",
"上拉加载",
@ -12,7 +12,6 @@
"虚拟列表"
],
"repository": "https://github.com/SmileZXLee/uni-z-paging",
"types": "global.d.ts",
"engines": {
"HBuilderX": "^3.0.7"
},
@ -47,8 +46,10 @@
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
"app-vue": "y",
"app-nvue": "y",
"app-harmony": "u",
"app-uvue": "u"
},
"H5-mobile": {
"Safari": "y",

View File

@ -4,7 +4,7 @@
<img alt="logo" src="https://z-paging.zxlee.cn/img/title-logo.png" height="100" style="margin-bottom: 50px;" />
</p>
[![version](https://img.shields.io/badge/version-2.7.11-blue)](https://github.com/SmileZXLee/uni-z-paging) [![license](https://img.shields.io/github/license/SmileZXLee/uni-z-paging)](https://en.wikipedia.org/wiki/MIT_License)
[![version](https://img.shields.io/badge/version-2.8.6-blue)](https://github.com/SmileZXLee/uni-z-paging) [![license](https://img.shields.io/github/license/SmileZXLee/uni-z-paging)](https://en.wikipedia.org/wiki/MIT_License)
<img height="0" width="0" src="https://api.z-notify.zxlee.cn/v1/public/statistics/8293556910106066944/addOnly?from=uni" />
`z-paging-x`现已支持uniapp x持续完善中插件地址👉🏻 [https://ext.dcloud.net.cn/plugin?name=z-paging-x](https://ext.dcloud.net.cn/plugin?name=z-paging-x)
@ -19,14 +19,15 @@
* 【低耦合低侵入】分页自动管理。在page中无需处理任何分页相关逻辑无需在data中定义任何分页相关变量全由z-paging内部处理。
* 【超灵活支持各种类型自定义】支持自定义下拉刷新自定义上拉加载更多等各种自定义效果支持使用内置自动分页同时也支持通过监听下拉刷新和滚动到底部事件自行处理支持使用自带全屏布局规范同时也支持将z-paging自由放在任意容器中。
* 【功能丰富】支持国际化支持自定义且自动管理空数据图支持主题模式切换支持本地分页支持无闪动聊天分页模式支持展示最后更新时间支持吸顶效果支持内部scroll-view滚动与页面滚动支持一键滚动到顶部支持下拉进入二楼等诸多功能。
* 【全平台兼容】支持vue、nvuevue2、vue3支持h5、app及各家小程序。
* 【高性能】在app-vue、h5、微信小程序、QQ小程序上使用wxs+renderjs视图层实现下拉刷新;支持虚拟列表,轻松渲染万级数据!
* 【【全平台兼容】支持vue&nvuevue2&vue3js&ts支持h5、app、鸿蒙Next及各家小程序。
* 【高性能】在app-vue、h5、微信小程序、QQ小程序上使用wxs+renderjs视图层实现下拉刷新;支持虚拟列表,轻松渲染万级列表数据!
***
### 反馈qq群
* 官方1群`已满`[790460711](https://jq.qq.com/?_wv=1027&k=vU2fKZZH)
* 官方2群[371624008](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=avPmibADf2TNi4LxkIwjCE5vbfXpa-r1&authKey=dQ%2FVDAR87ONxI4b32Py%2BvmXbhnopjHN7%2FJPtdsqJdsCPFZB6zDQ17L06Uh0kITUZ&noverify=0&group_code=371624008)
* 官方2群`已满`[371624008](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=avPmibADf2TNi4LxkIwjCE5vbfXpa-r1&authKey=dQ%2FVDAR87ONxI4b32Py%2BvmXbhnopjHN7%2FJPtdsqJdsCPFZB6zDQ17L06Uh0kITUZ&noverify=0&group_code=371624008)
* 官方3群[343409055](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=sIaNqiCMIjxGQVksjytCw6R8DSiibHR7&authKey=pp995q8ZzFtl5F2xUwvvceP24QTcguWW%2FRVoDnMa8JZF4L2DmS%2B%2FV%2F5sYrcgPsmW&noverify=0&group_code=343409055)
***

11
uni_modules/z-paging/types/comps.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
declare module 'vue' {
export interface GlobalComponents {
['z-paging']: typeof import('./comps/z-paging')['ZPaging']
['z-paging-swiper']: typeof import('./comps/z-paging-swiper')['ZPagingSwiper']
['z-paging-swiper-item']: typeof import('./comps/z-paging-swiper-item')['ZPagingSwiperItem']
['z-paging-empty-view']: typeof import('./comps/z-paging-empty-view')['ZPagingEmptyView']
['z-paging-cell']: typeof import('./comps/z-paging-cell')['ZPagingCell']
}
}
export {}

View File

@ -0,0 +1,9 @@
export interface AllowedComponentProps {
class?: unknown;
style?: unknown;
}
export interface VNodeProps {
key?: string | number | symbol;
ref?: unknown;
}

View File

@ -0,0 +1,29 @@
import { AllowedComponentProps, VNodeProps } from './_common'
// ****************************** Props ******************************
declare interface ZPagingCellProps {
/**
* z-paging-cell
*/
cellStyle?: Record<string, any>
}
// ****************************** Slots ******************************
declare interface ZPagingCellSlots {
// ******************** 主体布局Slot ********************
/**
* view
*/
['default']?: () => any
}
declare interface _ZPagingCell {
new (): {
$props: AllowedComponentProps &
VNodeProps &
ZPagingCellProps
$slots: ZPagingCellSlots
}
}
export declare const ZPagingCell: _ZPagingCell

View File

@ -0,0 +1,95 @@
import { AllowedComponentProps, VNodeProps } from './_common'
// ****************************** Props ******************************
declare interface ZPagingEmptyViewProps {
/**
* z-pagingz-paging
* @default false
* @since 2.0.3
*/
emptyViewFixed?: boolean;
/**
*
* @default "没有数据哦~"
*/
emptyViewText?: string;
/**
* 使z-paging
* - 使"@""/"
*/
emptyViewImg?: string;
/**
*
* @default "重新加载"
* @since 1.6.7
*/
emptyViewReloadText?: string;
/**
* viewtop
* - fixed`margin-top`
*/
emptyViewStyle?: Record<string, any>;
/**
* img
*/
emptyViewImgStyle?: Record<string, any>;
/**
*
*/
emptyViewTitleStyle?: Record<string, any>;
/**
*
* @since 1.6.7
*/
emptyViewReloadStyle?: Record<string, any>;
/**
* ()
* @default false
* @since 1.6.7
*/
showEmptyViewReload?: boolean;
/**
*
* @default false
*/
isLoadFailed?: boolean;
/**
*
* @default 'rpx'
* @since 2.6.7
*/
unit?: 'rpx' | 'px';
// ****************************** Events ******************************
/**
*
*/
onReload?: () => void
/**
* view
* @since 2.3.3
*/
onViewClick?: () => void
}
declare interface _ZPagingEmptyView {
new (): {
$props: AllowedComponentProps &
VNodeProps &
ZPagingEmptyViewProps
}
}
export declare const ZPagingEmptyView: _ZPagingEmptyView

View File

@ -0,0 +1,95 @@
import { AllowedComponentProps, VNodeProps } from './_common'
// ****************************** Props ******************************
declare interface ZPagingSwiperItemProps {
/**
* indexswiper
* @default 0
*/
tabIndex?: number
/**
* swiperindex
* @default 0
*/
currentIndex?: number
/**
* 使使nvuenvuez-paginglist
* @default false
*/
useVirtualList?: boolean
/**
* cell`fixed`cellcell
* @default 'fixed'
*/
cellHeightMode?: 'fixed' | 'dynamic'
/**
* ()dom()
* @default 12
*/
preloadPage?: number | string
/**
* 122
* @default 1
* @since 2.2.8
*/
virtualListCol?: number | string
/**
* scroll80
* @default 80
*/
virtualScrollFps?: number | string
/**
* z-paging(使)
* @default false
*/
useInnerList?: boolean
/**
* cellkey(nvuenvueuse-inner-list)
* @since 2.2.7
*/
cellKeyName?: string
/**
* innerList
*/
innerListStyle?: Record<string, any>
}
// ****************************** Methods ******************************
declare interface _ZPagingSwiperItemRef {
/**
* pageNo
*
* @param [animate=false]
*/
reload: (animate?: boolean) => void;
/**
*
* - completepageSize
*
* @param [data]
* @param [success=true]
*/
complete: (data?: any[] | false, success?: boolean) => void;
}
declare interface _ZPagingSwiperItem {
new (): {
$props: AllowedComponentProps &
VNodeProps &
ZPagingSwiperItemProps
}
}
export declare const ZPagingSwiperItem: _ZPagingSwiperItem
export declare const ZPagingSwiperItemRef: _ZPagingSwiperItemRef

View File

@ -0,0 +1,89 @@
import { AllowedComponentProps, VNodeProps } from './_common'
// ****************************** Props ******************************
declare interface ZPagingSwiperProps {
/**
* 使fixed使fixedz-paging-swiperviewz-pagingviewz-paging-swiperview使slot="top"view使slot="bottom"
* @default true
*/
fixed?: boolean
/**
*
* @default false
*/
safeAreaInsetBottom?: boolean
/**
* z-paging-swiper
*/
swiperStyle?: Record<string, any>
}
// ****************************** Slots ******************************
declare interface ZPagingSwiperSlots {
// ******************** 主体布局Slot ********************
/**
* view
*/
['default']?: () => any
/**
* tab-view()slot="top"view
* viewviewviewslot="top"viewposition: fixed;
* @since 1.5.5
*/
['top']?: () => any
/**
* ()slot="bottom"view
* viewviewviewslot="bottom"viewposition: fixed;
* @since 1.6.2
*/
['bottom']?: () => any
/**
* ()slot="left"view
* viewviewviewslot="left"viewposition: fixed;
* @since 2.2.3
*/
['left']?: () => any
/**
* ()slot="right"view
* viewviewviewslot="right"viewposition: fixed;
* @since 2.2.3
*/
['right']?: () => any
}
// ****************************** Methods ******************************
declare interface _ZPagingSwiperRef {
/**
* slot="left"slot="right"slot="left"slot="right"
*
* @since 2.3.5
*/
updateLeftAndRightWidth: () => void;
/**
* fixedz-paging-swiperonShowiOS+h5+tabbar+fixed+tabbartabbar
*
* @since 2.6.5
*/
updateFixedLayout: () => void;
}
declare interface _ZPagingSwiper {
new (): {
$props: AllowedComponentProps &
VNodeProps &
ZPagingSwiperProps
$slots: ZPagingSwiperSlots
}
}
export declare const ZPagingSwiper: _ZPagingSwiper
export declare const ZPagingSwiperRef: _ZPagingSwiperRef

File diff suppressed because it is too large Load Diff

24
uni_modules/z-paging/types/index.d.ts vendored Normal file
View File

@ -0,0 +1,24 @@
/// <reference path="./comps.d.ts" />
declare module 'z-paging' {
export function install() : void
/**
* z-paging
* - uni.$zp
*
* @since 2.6.5
*/
interface $zp {
/**
*
*/
config : Record<string, any>;
}
global {
interface Uni {
$zp : $zp
}
}
}
declare type ZPagingSwiperRef = typeof import('./comps/z-paging-swiper')['ZPagingSwiperRef']
declare type ZPagingSwiperItemRef = typeof import('./comps/z-paging-swiper-item')['ZPagingSwiperItemRef']