hw-cus-ui 1.1.5 → 1.1.7

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.
@@ -85,8 +85,6 @@
85
85
 
86
86
  <script lang="ts" setup>
87
87
  import { ref, watch } from 'vue';
88
- // @ts-ignore
89
- import * as FileSaver from 'file-saver';
90
88
 
91
89
  // 导入uni-app的类型定义
92
90
  declare const uni: any;
@@ -201,12 +199,67 @@ const handleDownload = (file: any) => {
201
199
  */
202
200
  async function convertUrlToBlob(url: string, name: string) {
203
201
  try {
204
- const response = await fetch(url);
205
- if (!response.ok) {
206
- throw new Error(`HTTP错误: ${response.status}`);
207
- }
208
- const blob = await response.blob();
209
- FileSaver.saveAs(blob, name);
202
+ // 在UniApp环境中,使用 uni.downloadFile API 替代 file-saver
203
+ uni.downloadFile({
204
+ url: url,
205
+ success: (res: any) => {
206
+ if (res.statusCode === 200) {
207
+ // 下载成功后,使用 uni.saveFile 保存到本地
208
+ uni.saveFile({
209
+ tempFilePath: res.tempFilePath,
210
+ success: (saveRes: any) => {
211
+ uni.showToast({
212
+ title: '文件已保存至:' + saveRes.savedFilePath,
213
+ icon: 'none',
214
+ duration: 2000
215
+ });
216
+ },
217
+ fail: () => {
218
+ // 如果无法保存到本地,尝试使用其他方式打开文件
219
+ uni.openDocument({
220
+ filePath: res.tempFilePath,
221
+ success: () => {
222
+ console.log('打开文档成功');
223
+ },
224
+ fail: (err: any) => {
225
+ console.log('打开文档失败', err);
226
+ // 在微信小程序环境中,可能无法直接保存文件,这里提供提示
227
+ uni.showModal({
228
+ title: '提示',
229
+ content: '当前环境不支持直接保存文件,您可以点击右上角菜单选择"保存到手机"功能',
230
+ showCancel: false
231
+ });
232
+ }
233
+ });
234
+ }
235
+ });
236
+ } else {
237
+ console.log('下载失败', res);
238
+ }
239
+ },
240
+ fail: (err: any) => {
241
+ console.log('下载失败', err);
242
+ // 如果 uni.downloadFile 失败,尝试使用浏览器原生下载
243
+ if (typeof window !== 'undefined' && window.navigator && (window.navigator as any).msSaveOrOpenBlob) {
244
+ // IE浏览器
245
+ const xhr = new XMLHttpRequest();
246
+ xhr.open('GET', url, true);
247
+ xhr.responseType = 'blob';
248
+ xhr.onload = () => {
249
+ const blob = xhr.response;
250
+ (window.navigator as any).msSaveOrOpenBlob(blob, name);
251
+ };
252
+ xhr.send();
253
+ } else {
254
+ // 其他浏览器
255
+ const link = document.createElement('a');
256
+ link.href = url;
257
+ link.download = name;
258
+ link.target = '_blank';
259
+ link.click();
260
+ }
261
+ }
262
+ });
210
263
  } catch (error) {
211
264
  console.log(error);
212
265
  }
package/index.d.ts CHANGED
@@ -7,12 +7,12 @@ import HwInput from './HwInput';
7
7
  import HwFileUpload from './HwFileUpload';
8
8
  import HwCheckbox from './HwCheckbox';
9
9
  import HwTabs from './HwTabs';
10
- import HwAppList from './z-paging/components/z-paging/z-paging.vue';
10
+ import ZPaging from './z-paging';
11
11
 
12
- export { HwBtn, HwDraggableBottomPopup, HwSelect, HwPickerTree, HwInput, HwFileUpload, HwCheckbox, HwTabs, HwAppList };
12
+ export { HwBtn, HwDraggableBottomPopup, HwSelect, HwPickerTree, HwInput, HwFileUpload, HwCheckbox, HwTabs, ZPaging };
13
13
 
14
14
  export declare const hwCusUi: {
15
15
  install: (app: App) => void;
16
16
  };
17
17
 
18
- export default hwCusUi;
18
+ export default hwCusUi;
package/index.ts CHANGED
@@ -8,9 +8,9 @@ import HwInput from './HwInput';
8
8
  import HwFileUpload from './HwFileUpload';
9
9
  import HwCheckbox from './HwCheckbox';
10
10
  import HwTabs from './HwTabs';
11
- import HwAppList from './z-paging/components/z-paging/z-paging.vue';
11
+ import ZPaging from './z-paging';
12
12
 
13
- export { HwBtn, HwDraggableBottomPopup, HwSelect, HwPickerTree, HwInput, HwFileUpload, HwCheckbox, HwTabs, HwAppList };
13
+ export { HwBtn, HwDraggableBottomPopup, HwSelect, HwPickerTree, HwInput, HwFileUpload, HwCheckbox, HwTabs, ZPaging };
14
14
 
15
15
  // 所有组件列表
16
16
  const components = [
@@ -22,7 +22,7 @@ const components = [
22
22
  HwFileUpload,
23
23
  HwCheckbox,
24
24
  HwTabs,
25
- HwAppList
25
+ ZPaging
26
26
  ];
27
27
 
28
28
  // 定义 install 方法
@@ -35,4 +35,4 @@ const hwCusUi = {
35
35
  install
36
36
  };
37
37
 
38
- export default hwCusUi;
38
+ export default hwCusUi;
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "hw-cus-ui",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "使用该组件库需安装uniapp插件@dcloudio/uni-ui",
5
5
  "main": "index.ts",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
- "keywords": [],
9
+ "keywords": [
10
+ "uniapp",
11
+ "vue",
12
+ "ui",
13
+ "component",
14
+ "pagination",
15
+ "scroll"
16
+ ],
10
17
  "author": "",
11
18
  "license": "ISC",
12
19
  "type": "commonjs",
@@ -16,29 +16,16 @@
16
16
  </template>
17
17
 
18
18
  <script>
19
- import zStatic from '../z-paging/js/z-paging-static'
19
+ // #ifdef APP-NVUE
20
+ import zStatic from '../z-paging/js/z-paging-static';
21
+ // #endif
20
22
 
21
- /**
22
- * z-paging-empty-view 空数据组件
23
- * @description 通用的 z-paging 空数据组件
24
- * @tutorial https://z-paging.zxlee.cn/api/sub-components/main.html#z-paging-empty-view配置
25
- * @property {Boolean} emptyViewFixed 空数据图片是否铺满 z-paging,默认为 false。若设置为 true,则为填充满 z-paging 的剩余部分
26
- * @property {String} emptyViewText 空数据图描述文字,默认为 '没有数据哦~'
27
- * @property {String} emptyViewImg 空数据图图片,默认使用 z-paging 内置的图片 (建议使用绝对路径,开头不要添加 "@",请以 "/" 开头)
28
- * @property {String} emptyViewReloadText 空数据图点击重新加载文字,默认为 '重新加载'
29
- * @property {Object} emptyViewStyle 空数据图样式,可设置空数据 view 的 top 等,如: empty-view-style="{'top':'100rpx'}" (如果空数据图不是 fixed 布局,则此处是 margin-top),默认为 {}
30
- * @property {Object} emptyViewImgStyle 空数据图 img 样式,默认为 {}
31
- * @property {Object} emptyViewTitleStyle 空数据图描述文字样式,默认为 {}
32
- * @property {Object} emptyViewReloadStyle 空数据图重新加载按钮样式,默认为 {}
33
- * @property {Boolean} showEmptyViewReload 是否显示空数据图重新加载按钮(无数据时),默认为 false
34
- * @property {Boolean} isLoadFailed 是否是加载失败,默认为 false
35
- * @property {String} unit 空数据图中布局的单位,默认为 'rpx'
36
- * @event {Function} reload 点击了重新加载按钮
37
- * @event {Function} viewClick 点击了空数据图 view
38
- * @example <z-paging-empty-view empty-view-text="暂无数据" />
39
- */
23
+ // #ifndef APP-NVUE
24
+ import zStatic from '../js/z-paging-static';
25
+ // #endif
40
26
  export default {
41
- name: "z-paging-empty-view",
27
+ name: 'z-paging-empty-view',
28
+ mixins: [zStatic],
42
29
  data() {
43
30
  return {
44
31
 
@@ -26,19 +26,15 @@
26
26
  </template>
27
27
 
28
28
  <script>
29
- import commonLayoutModule from '../z-paging/js/modules/common-layout'
29
+ // #ifdef APP-NVUE
30
+ import commonLayoutModule from '../z-paging/js/modules/common-layout';
31
+ // #endif
30
32
 
31
- /**
32
- * z-paging-swiper 组件
33
- * @description 在 swiper 中使用 z-paging 时(左右滑动切换列表),在根节点使用 z-paging-swiper,其相当于一个 view 容器,默认铺满全屏,可免计算高度直接插入 swiper 的视图容器。
34
- * @tutorial https://z-paging.zxlee.cn/api/sub-components/main.html#z-paging-swiper配置
35
- * @property {Boolean} fixed 是否使用 fixed 布局,默认为 true
36
- * @property {Boolean} safeAreaInsetBottom 是否开启底部安全区域适配,默认为 false
37
- * @property {Object} swiperStyle z-paging-swiper 样式,默认为 {}
38
- * @example <z-paging-swiper :safeAreaInsetBottom="true"></z-paging-swiper>
39
- */
33
+ // #ifndef APP-NVUE
34
+ import commonLayoutModule from '../js/modules/common-layout';
35
+ // #endif
40
36
  export default {
41
- name: "z-paging-swiper",
37
+ name: 'z-paging-swiper',
42
38
  mixins: [commonLayoutModule],
43
39
  data() {
44
40
  return {
@@ -25,26 +25,15 @@
25
25
  </template>
26
26
 
27
27
  <script>
28
- import zPaging from '../z-paging/z-paging'
29
- /**
30
- * z-paging-swiper-item 组件
31
- * @description swiper+list极简写法中使用到,实际上就是对普通的swiper+list中swiper-item的包装封装,用以简化写法,但个性化配置局限较多
32
- * @tutorial https://z-paging.zxlee.cn/api/sub-components/main.html#z-paging-swiper-item配置
33
- * @notice 以下为 z-paging-swiper-item 的配置项
34
- * @property {Number} tabIndex 当前组件的 index,也就是当前组件是 swiper 中的第几个,默认为 0
35
- * @property {Number} currentIndex 当前 swiper 切换到第几个 index,默认为 0
36
- * @property {Boolean} useVirtualList 是否使用虚拟列表,默认为 false
37
- * @property {Boolean} useInnerList 是否在 z-paging 内部循环渲染列表(内置列表),默认为 false。若 useVirtualList 为 true,则此项恒为 true
38
- * @property {String} cellKeyName 内置列表 cell 的 key 名称,仅 nvue 有效,在 nvue 中开启 useInnerList 时必须填此项,默认为 ''
39
- * @property {Object} innerListStyle innerList 样式,默认为 {}
40
- * @property {Number|String} preloadPage 预加载的列表可视范围(列表高度)页数,默认为 12。此数值越大,则虚拟列表中加载的 dom 越多,内存消耗越大(会维持在一个稳定值),但增加预加载页面数量可缓解快速滚动短暂白屏问题
41
- * @property {String} cellHeightMode 虚拟列表 cell 高度模式,默认为 'fixed',也就是每个 cell 高度完全相同,将以第一个 cell 高度为准进行计算。可选值【dynamic】,即代表高度是动态非固定的,【dynamic】性能低于【fixed】
42
- * @property {Number|String} virtualListCol 虚拟列表列数,默认为 1。常用于每行有多列的情况,例如每行有 2 列数据,需要将此值设置为 2
43
- * @property {Number|String} virtualScrollFps 虚拟列表 scroll 取样帧率,默认为 60,过高可能出现卡顿等问题
44
- * @example <z-paging-swiper-item ref="swiperItem" :tabIndex="index" :currentIndex="current" @query="queryList" @updateList="updateList"></z-paging-swiper-item>
45
- */
28
+ // #ifdef APP-NVUE
29
+ import zPaging from '../z-paging/z-paging';
30
+ // #endif
31
+
32
+ // #ifndef APP-NVUE
33
+ import zPaging from '../z-paging/z-paging';
34
+ // #endif
46
35
  export default {
47
- name: "z-paging-swiper-item",
36
+ name: 'z-paging-swiper-item',
48
37
  components: { zPaging },
49
38
  data() {
50
39
  return {
@@ -0,0 +1,3 @@
1
+ declare const ZPaging: any;
2
+
3
+ export default ZPaging;
@@ -0,0 +1,7 @@
1
+ import ZPaging from './components/z-paging/z-paging.vue';
2
+
3
+ ZPaging.install = function(Vue: any) {
4
+ Vue.component(ZPaging.name, ZPaging);
5
+ };
6
+
7
+ export default ZPaging;
@@ -1,51 +0,0 @@
1
- ## 2.8.7(2025-05-30)
2
- 1.`新增` props:`layout-only`,支持仅使用基础布局。
3
- 2.`新增` `goF2`方法,支持手动触发进入二楼。
4
- 3.`新增` `@scrollDirectionChange`事件,支持监听列表滚动方向改变。
5
- 4.`新增` props:`paging-class`,支持直接设置`z-paging`的`class`。
6
- 5.`新增` `addKeyboardHeightChangeListener`方法,支持手动添加键盘高度变化监听。
7
- 6.`修复` `scrollIntoViewById`方法在存在`slot=top`或局部区域滚动时,滚动的位置不准确的问题。
8
- 7.`优化` 重构底部安全区域处理逻辑,修改为占位view的方式,处理方案更灵活并支持自定义底部安全区域颜色。
9
- 8.`优化` 兼容在`nvue`+`vue3`中使用`waterfall`。
10
- 9.`优化` 规范`types`中对`style`类型的约束。
11
- ## 2.8.6(2025-03-17)
12
- 1.`新增` 聊天记录模式流式输出(类似chatGPT回答)演示demo。
13
- 2.`新增` z-paging及其公共子组件支持`HBuilderX`代码文档提示。
14
- 3.`新增` props:`virtual-in-swiper-slot`,用以解决vue3+(微信小程序或QQ小程序)中,使用非内置列表写法时,若z-paging在`swiper-item`中存在的无法获取slot插入的cell高度进而导致虚拟列表失败的问题。
15
- 4.`新增` `@scrolltolower`和@`scrolltoupper`支持nvue。
16
- 5.`修复` 由`v2.8.1`引出的方法`scrollIntoViewById`在微信小程序+vue3中无效的问题。
17
- 6.`修复` 由`v2.8.1`引出的在子组件内使用z-paging虚拟列表无效的问题。
18
- 7.`修复` 在微信小程序中基础库版本较高时`wx.getSystemInfoSync is deprecated`警告。
19
- 8.`优化` 提升下拉刷新在鸿蒙Next中的性能。
20
- 9.`优化` `@scrolltolower`和`@scrolltoupper`在倒置的聊天记录模式下的触发逻辑。
21
- 10.`优化` 其他细节调整。
22
- ## 2.8.5(2025-02-09)
23
- 1.`新增` 方法`scrollToX`,支持控制x轴滚动到指定位置。
24
- 2.`修复` 快手小程序中报错`await isn't allowed in non-async function`的问题。
25
- 3.`修复` 在iOS+nvue中,设置了`:loading-more-enabled="false"`后,调用`scrollToBottom`无法滚动到底部的问题。
26
- 4.`修复` 在支付宝小程序+页面滚动中,数据为空时空数据图未居中的问题。
27
- 5.`优化` fetch types修改。
28
- ## 2.8.4(2024-12-02)
29
- 1.`修复` 在虚拟列表+vue2中,顶部占位采用transformY方案;在虚拟列表+vue3中,顶部占位采用view占位方案。以解决在vue2+微信小程序+安卓+兼容模式中,可能出现的虚拟列表闪动的问题。
30
- 2.`修复` 在列表渲染时(尤其是在虚拟列表中)偶现的【点击加载更多】闪现的问题。
31
- 3.`优化` 统一在RefresherStatus枚举中Loading取值。
32
- 4.`优化` `defaultPageNo`&`defaultPageSize`修改为只允许number类型。
33
- 5.`优化` 提升兼容性&细节优化。
34
- ## 2.8.3(2024-11-27)
35
- 1.`修复` `doInsertVirtualListItem`插入数据无效的问题。
36
- 2.`优化` 提升兼容性&细节优化。
37
- ## 2.8.2(2024-11-25)
38
- 1.`优化` types中`ZPagingRef`和`ZPagingInstance`支持泛型。
39
- ## 2.8.1(2024-11-24)
40
- 1.`新增` 完整的`props`、`slots`、`methods`、`events`的typescript types声明,可在ts中获得绝佳的代码提示体验。
41
- 2.`新增` `virtual-cell-id-prefix`:虚拟列表cell id的前缀,适用于一个页面有多个虚拟列表的情况,用以区分不同虚拟列表cell的id。
42
- 3.`修复` 在vue3+(微信小程序或QQ小程序)中,使用非内置列表写法时,若`z-paging`在`swiper-item`标签内的情况下存在的无法获取slot插入的cell高度的问题。
43
- 4.`修复` 在虚拟列表中分页数据小于1页时插入新数据,虚拟列表未生效的问题。
44
- 5.`修复` 在虚拟列表中调用`refresh`时,cell的index计算不正确的问题。
45
- 6.`修复` 在快手小程序中内容较少或空数据时`z-paging`未能铺满全屏的问题。
46
- 7.`优化` `events`中的参数涉及枚举的部分,统一由之前的number类型修改为string类型,展示更直观!涉及的events:`@query`中的`from`参数;`@refresherStatusChange`中的`status`参数;`@loadingStatusChange`中的`status`参数;`slot=refresher`中的`refresherStatus`参数;`slot=chatLoading`中的`loadingMoreStatus`参数。更新版本请特别留意!
47
- ## 2.8.0(2024-10-21)
48
- 1.`新增` 全面支持鸿蒙Next。
49
- 2.`修复` 设置了`refresher-complete-delay`后,在下拉刷新期间调用reload导致的无法再次下拉刷新的问题。
50
- 3.`优化` 废弃虚拟列表transformY顶部占位方案,修改为空view占位。解决因使用旧方案导致的vue3中可能出现的虚拟列表闪动问题。提升虚拟列表的兼容性。
51
-
@@ -1,89 +0,0 @@
1
- {
2
- "id": "z-paging",
3
- "name": "z-paging",
4
- "displayName": "【z-paging下拉刷新、上拉加载】高性能,全平台兼容。支持虚拟列表,分页全自动处理",
5
- "version": "2.8.7",
6
- "description": "超简单、低耦合!使用wxs+renderjs实现。支持自定义下拉刷新、上拉加载更多、虚拟列表、下拉进入二楼、自动管理空数据图、无闪动聊天分页、本地分页、国际化等数百项配置",
7
- "keywords": [
8
- "下拉刷新",
9
- "上拉加载",
10
- "分页器",
11
- "nvue",
12
- "虚拟列表"
13
- ],
14
- "repository": "https://github.com/SmileZXLee/uni-z-paging",
15
- "engines": {
16
- "HBuilderX": "^3.0.7"
17
- },
18
- "dcloudext": {
19
- "sale": {
20
- "regular": {
21
- "price": "0.00"
22
- },
23
- "sourcecode": {
24
- "price": "0.00"
25
- }
26
- },
27
- "contact": {
28
- "qq": "393727164"
29
- },
30
- "declaration": {
31
- "ads": "无",
32
- "data": "无",
33
- "permissions": "无"
34
- },
35
- "npmurl": "https://www.npmjs.com/package/z-paging",
36
- "type": "component-vue"
37
- },
38
- "uni_modules": {
39
- "dependencies": [],
40
- "encrypt": [],
41
- "platforms": {
42
- "cloud": {
43
- "tcb": "y",
44
- "aliyun": "y",
45
- "alipay": "n"
46
- },
47
- "client": {
48
- "App": {
49
- "app-vue": "y",
50
- "app-nvue": "y",
51
- "app-harmony": "u",
52
- "app-uvue": "u"
53
- },
54
- "H5-mobile": {
55
- "Safari": "y",
56
- "Android Browser": "y",
57
- "微信浏览器(Android)": "y",
58
- "QQ浏览器(Android)": "y"
59
- },
60
- "H5-pc": {
61
- "Chrome": "y",
62
- "IE": "y",
63
- "Edge": "y",
64
- "Firefox": "y",
65
- "Safari": "y"
66
- },
67
- "小程序": {
68
- "微信": "y",
69
- "阿里": "y",
70
- "百度": "y",
71
- "字节跳动": "y",
72
- "QQ": "y",
73
- "钉钉": "y",
74
- "快手": "y",
75
- "飞书": "y",
76
- "京东": "y"
77
- },
78
- "快应用": {
79
- "华为": "y",
80
- "联盟": "y"
81
- },
82
- "Vue": {
83
- "vue2": "y",
84
- "vue3": "y"
85
- }
86
- }
87
- }
88
- }
89
- }