z-paging-wevu 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 littleturtle2333
4
+ Copyright (c) 2021 zxlee
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,95 @@
1
- # Temporary Holding Version
1
+ # z-paging-wevu
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 面向 **weapp-vite + wevu + Vue SFC** 的 z-paging 兼容实现。保留 z-paging 的分页心智模型,同时针对微信小程序运行时处理事件参数、虚拟列表和布局差异。
4
+
5
+ > 当前版本为 0.1.0,目标是微信小程序;nvue 专属渲染仅保留兼容入口。
6
+
7
+ ## 能力
8
+
9
+ - 自动分页、下拉刷新、触底或点击加载更多
10
+ - `complete` / `completeByKey` / `completeByTotal` / `completeByNoMore`
11
+ - 内置 `fetch`、本地分页、缓存、空态与加载失败
12
+ - 页面滚动、整屏 `scroll-view`、顶部/底部/左右插槽
13
+ - 固定和动态高度虚拟列表、聊天记录模式、键盘适配
14
+ - 自定义下拉刷新、二楼 F2、返回顶部、国际化文本
15
+ - TypeScript 类型与 `createPagingController()` 控制器
16
+
17
+ ## 安装
18
+
19
+ ```bash
20
+ pnpm add z-paging-wevu wevu
21
+ ```
22
+
23
+ 也可以直接将 `src/components/z-paging-wevu/` 复制到项目的组件目录。
24
+
25
+ ## 快速开始
26
+
27
+ ```vue
28
+ <script setup lang="ts">
29
+ import { ref } from 'wevu'
30
+ import ZPagingWevu, { createPagingController } from 'z-paging-wevu'
31
+
32
+ const items = ref<Record<string, unknown>[]>([])
33
+ const paging = createPagingController()
34
+
35
+ async function queryList([pageNo, pageSize]: [number, number, string]) {
36
+ const result = await fetchYourPage({ pageNo, pageSize })
37
+ await paging.complete(result)
38
+ }
39
+ </script>
40
+
41
+ <template>
42
+ <ZPagingWevu
43
+ v-model="items"
44
+ :controller="paging"
45
+ paging-data-key="order-list"
46
+ @query="queryList"
47
+ >
48
+ <view v-for="item in items" :key="String(item.id)">
49
+ {{ item.title }}
50
+ </view>
51
+ </ZPagingWevu>
52
+ </template>
53
+ ```
54
+
55
+ **注意:** wevu 自定义组件的多参数事件会合并为数组,因此 `@query` 的参数是一个数组。请求结束后必须调用 `complete` 系列方法;刷新列表使用 `reload()`,不要手动调用内部查询流程。
56
+
57
+ ## 文档
58
+
59
+ 在线文档:<https://littleturtle2333.github.io/z-paging-wevu/>
60
+
61
+ ```bash
62
+ pnpm install
63
+ pnpm dev
64
+ ```
65
+
66
+ 构建组件类型检查与文档站:
67
+
68
+ ```bash
69
+ pnpm build
70
+ ```
71
+
72
+ 文档覆盖安装、两种滚动模式、Props / Methods / Events / Slots,以及虚拟列表、聊天、本地分页、缓存和迁移注意事项。
73
+
74
+ 真实浏览器验收(首次运行需要安装 Chromium):
75
+
76
+ ```bash
77
+ pnpm exec playwright install chromium
78
+ pnpm test:docs
79
+ ```
80
+
81
+ 验收脚本会临时启动文档服务,检查主要导航、主题切换、移动端横向溢出、控制台错误和失败请求,并在结束时关闭服务与浏览器。
82
+
83
+ ## 与 z-paging 的主要差异
84
+
85
+ - 微信中使用 `paging-data-key`,避免原生 `data-*` 属性冲突。
86
+ - 微信虚拟列表推荐 `force-close-inner-list` + `@virtual-list-change` + 页面 `v-for`。
87
+ - 每个虚拟列表 cell 的 DOM id 必须为 `zp-id-${item.zp_index}`。
88
+ - 聊天消息项需要设置 `transform: scaleY(-1)` 恢复内容方向。
89
+ - `withDefaults` 默认值保留在 SFC 内,避免 wevu 不支持的 `mergeDefaults` 辅助函数。
90
+
91
+ ## 致谢与许可
92
+
93
+ 本项目是 [SmileZXLee/uni-z-paging](https://github.com/SmileZXLee/uni-z-paging) 的独立兼容实现,API 与文档组织参考了原项目及其文档仓库。原项目采用 MIT 许可证;相关版权声明保留在 [LICENSE](./LICENSE) 中。
94
+
95
+ 本项目同样采用 MIT 许可证。
package/package.json CHANGED
@@ -1,6 +1,78 @@
1
1
  {
2
2
  "name": "z-paging-wevu",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "面向 weapp-vite + wevu 的 z-paging 兼容分页组件",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "littleturtle2333",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/LittleTurtle2333/z-paging-wevu.git"
11
+ },
12
+ "homepage": "https://littleturtle2333.github.io/z-paging-wevu/",
13
+ "bugs": {
14
+ "url": "https://github.com/LittleTurtle2333/z-paging-wevu/issues"
15
+ },
16
+ "keywords": [
17
+ "z-paging",
18
+ "weapp-vite",
19
+ "wevu",
20
+ "miniprogram",
21
+ "pagination",
22
+ "virtual-list"
23
+ ],
24
+ "main": "./src/index.ts",
25
+ "module": "./src/index.ts",
26
+ "types": "./src/index.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./src/index.ts",
30
+ "default": "./src/index.ts"
31
+ },
32
+ "./component": "./src/components/z-paging-wevu/index.vue",
33
+ "./controller": {
34
+ "types": "./src/components/z-paging-wevu/types.ts",
35
+ "default": "./src/components/z-paging-wevu/types.ts"
36
+ },
37
+ "./props": {
38
+ "types": "./src/components/z-paging-wevu/props.ts",
39
+ "default": "./src/components/z-paging-wevu/props.ts"
40
+ }
41
+ },
42
+ "files": [
43
+ "src",
44
+ "README.md",
45
+ "LICENSE"
46
+ ],
47
+ "sideEffects": [
48
+ "**/*.vue",
49
+ "**/*.css"
50
+ ],
51
+ "scripts": {
52
+ "dev": "vitepress dev docs",
53
+ "dev:docs": "vitepress dev docs",
54
+ "docs:build": "vitepress build docs",
55
+ "docs:preview": "vitepress preview docs",
56
+ "typecheck": "vue-tsc --noEmit -p tsconfig.json",
57
+ "test:docs": "node scripts/verify-docs.mjs",
58
+ "build": "pnpm typecheck && pnpm docs:build"
59
+ },
60
+ "peerDependencies": {
61
+ "wevu": ">=7.5.0"
62
+ },
63
+ "devDependencies": {
64
+ "@types/node": "^24.0.0",
65
+ "miniprogram-api-typings": "^5.2.3",
66
+ "playwright": "^1.64.1",
67
+ "typescript": "^6.0.3",
68
+ "vitepress": "^1.6.4",
69
+ "vue": "^3.5.13",
70
+ "vue-tsc": "^3.3.12",
71
+ "wevu": "^7.5.0"
72
+ },
73
+ "engines": {
74
+ "node": ">=20.19.0",
75
+ "pnpm": ">=9"
76
+ },
77
+ "packageManager": "pnpm@11.20.0"
78
+ }