uview-pro 0.4.8 → 0.4.10

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/changelog.md CHANGED
@@ -1,19 +1,62 @@
1
- ## 0.4.8(2025-12-23
1
+ ## 0.4.10(2025-12-26
2
+
3
+ ### 🚀 Chore | 构建/工程依赖/工具
4
+
5
+ - **contributors:** 更新贡献者映射配置 ([d496b21](https://github.com/anyup/uView-Pro/commit/d496b21d85bede68fefc9ffd752e31ecde14735a))
2
6
 
3
7
  ### 🐛 Bug Fixes | Bug 修复
4
8
 
5
- - **u-avatar:** 修复 ios 微信小程序默认头像不显示问题 ([9e3420f](https://github.com/anyup/uView-Pro/commit/9e3420fb8d0db533ce7fb3a8e83543b43ac0c7a7))
6
- - 修复 u-cell 组件中使用 u-icon 样式在微信小程序不生效问题,修复 u-upload 图片上传失败重试是否显示提示配置不生效问题 ([e591d62](https://github.com/anyup/uView-Pro/commit/e591d62befce95c207ca47158549e6fd97f1e58d))
7
- - **u-cell-item:** 修复图标样式问题并优化组件结构 ([294bf4b](https://github.com/anyup/uView-Pro/commit/294bf4be88fb53a2ccd72fcc8702b09f6d736a30))
9
+ - **u-popup:** 修复u-popup设置mode=center,点击遮罩层无法关闭的问题 ([3896019](https://github.com/anyup/uView-Pro/commit/389601965933d9e1dc74d32c370c4e858df86595))
10
+ - **u-upload:** 优化u-upload组件在多个平台的样式兼容性 ([bfb60b5](https://github.com/anyup/uView-Pro/commit/bfb60b5c2f431d14425eceed9c9e5c248e7cfa29))
8
11
 
9
- ### ♻️ Code Refactoring | 代码重构
12
+ ### Features | 新功能
10
13
 
11
- - **theme:** 修改主题默认为官方内置主题,暗黑模式默认为亮色 ([176b482](https://github.com/anyup/uView-Pro/commit/176b48210209ae362fe30e459e73dff6fc81b53e))
14
+ - **u-tabbar:** 增强u-tabbar组件能力,支持文字和图标显示隐藏配置功能 ([29f3394](https://github.com/anyup/uView-Pro/commit/29f3394d7e8a5e2a818e397ffe97420855970333))
12
15
 
13
16
  ### 👥 Contributors
14
17
 
15
- <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a> <a href="https://github.com/lime"><img src="https://github.com/lime.png?size=40" width="40" height="40" alt="lime" title="lime"/></a>
18
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
16
19
 
20
+ ## 0.4.9(2025-12-24)
21
+
22
+ ### 📝 Documentation | 文档
23
+
24
+ - **readme:** 修复捐赠页面链接 ([93323ab](https://github.com/anyup/uView-Pro/commit/93323ab414ddc5a4542604928f221a050cbe55c5))
25
+
26
+ ### ✨ Features | 新功能
27
+
28
+ - **request:** 增强http请求工具,添加请求超时配置和全局配置合并功能 ([54d4a44](https://github.com/anyup/uView-Pro/commit/54d4a448a82d76889524cc2ad0f8f08b758b73fb))
29
+ - **http:** 修改http请求实例和响应拦截器 ([d566496](https://github.com/anyup/uView-Pro/commit/d56649673103b519492033504aa387cd6d037721))
30
+ - **source:** 添加静态资源文件 ([346bce6](https://github.com/anyup/uView-Pro/commit/346bce63126c4cb2c9db1f1665568eb11e26be07))
31
+ - **pages:** 优化多个页面演示样式,统一布局和暗黑模式 ([da68f17](https://github.com/anyup/uView-Pro/commit/da68f17ddf3018f7f5d53a7eebfb3dc1bad550ab))
32
+ - **i18n:** 完善国际化支持文案 ([68accbd](https://github.com/anyup/uView-Pro/commit/68accbd1d864f190e510de380d4ed8d603f8676b))
33
+ - **pages:** 更新iconfont图标 ([bafd4af](https://github.com/anyup/uView-Pro/commit/bafd4af26f6d2ca4dbe6e818b31be84f57c787b0))
34
+ - **demo-page:** 调整演示页面样式并添加tabbar支持 ([f4c5cfc](https://github.com/anyup/uView-Pro/commit/f4c5cfc70920b50602f226220ded4690279cb331))
35
+
36
+ ### 🚀 Chore | 构建/工程依赖/工具
37
+
38
+ - **harmony:** 添加调试配置并调整harmony兼容版本 ([bd18fd2](https://github.com/anyup/uView-Pro/commit/bd18fd234bf0aec9671663f5b26294b4622bae81))
39
+
40
+ ### 👥 Contributors
41
+
42
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
43
+
44
+ ## 0.4.8(2025-12-23)
45
+
46
+ ### 🐛 Bug Fixes | Bug 修复
47
+
48
+ - **u-avatar:** 修复 ios 微信小程序默认头像不显示问题 ([9e3420f](https://github.com/anyup/uView-Pro/commit/9e3420fb8d0db533ce7fb3a8e83543b43ac0c7a7))
49
+ - 修复 u-cell 组件中使用 u-icon 样式在微信小程序不生效问题,修复 u-upload 图片上传失败重试是否显示提示配置不生效问题 ([e591d62](https://github.com/anyup/uView-Pro/commit/e591d62befce95c207ca47158549e6fd97f1e58d))
50
+ - **u-cell-item:** 修复图标样式问题并优化组件结构 ([294bf4b](https://github.com/anyup/uView-Pro/commit/294bf4be88fb53a2ccd72fcc8702b09f6d736a30))
51
+
52
+ ### ♻️ Code Refactoring | 代码重构
53
+
54
+ - **theme:** 修改主题默认为官方内置主题,暗黑模式默认为亮色 ([176b482](https://github.com/anyup/uView-Pro/commit/176b48210209ae362fe30e459e73dff6fc81b53e))
55
+
56
+ ### 👥 Contributors
57
+
58
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a> <a href="https://github.com/limes-cloud"><img src="https://github.com/limes-cloud.png?size=40" width="40" height="40" alt="limes-cloud" title="limes-cloud"/></a>
59
+
17
60
  ## 0.4.7(2025-12-19)
18
61
 
19
62
  ### 🚀 Chore | 构建/工程依赖/工具
@@ -24,7 +24,6 @@
24
24
  zoom && mode == 'center' ? 'u-animation-zoom' : ''
25
25
  ]"
26
26
  @touchmove.stop.prevent
27
- @tap.stop.prevent
28
27
  :style="[style]"
29
28
  >
30
29
  <view
@@ -20,6 +20,8 @@ export const TabbarProps = {
20
20
  iconSize: { type: [String, Number] as PropType<string | number>, default: 40 },
21
21
  /** 凸起图标的大小,单位任意,数值默认rpx */
22
22
  midButtonSize: { type: [String, Number] as PropType<string | number>, default: 90 },
23
+ /** 文本大小,单位任意,数值默认rpx */
24
+ textSize: { type: [String, Number] as PropType<string | number>, default: 26 },
23
25
  /** 激活时的颜色 */
24
26
  activeColor: { type: String, default: 'var(--u-main-color)' },
25
27
  /** 未激活时的颜色 */
@@ -20,14 +20,18 @@
20
20
  :style="{ backgroundColor: props.bgColor }"
21
21
  >
22
22
  <view
23
+ v-if="item.iconPath || item.selectedIconPath"
23
24
  :class="[
24
25
  props.midButton && item.midButton
25
26
  ? 'u-tabbar__content__circle__button'
26
- : 'u-tabbar__content__item__button'
27
+ : 'u-tabbar__content__item__button',
28
+ !item.text && (item.iconPath || item.selectedIconPath)
29
+ ? 'u-tabbar__content__item__button--center'
30
+ : ''
27
31
  ]"
28
32
  >
29
33
  <u-icon
30
- :size="props.midButton && item.midButton ? props.midButtonSize : props.iconSize"
34
+ :size="getIconSize(index)"
31
35
  :name="elIconPath(index)"
32
36
  img-mode="scaleToFill"
33
37
  :color="elColor(index)"
@@ -40,7 +44,14 @@
40
44
  :offset="[-2, getOffsetRight(item.count, item.isDot)]"
41
45
  ></u-badge>
42
46
  </view>
43
- <view class="u-tabbar__content__item__text" :style="{ color: elColor(index) }">
47
+ <view
48
+ v-if="item.text"
49
+ class="u-tabbar__content__item__text"
50
+ :class="{
51
+ 'u-tabbar__content__item__text--center': item.text && !(item.iconPath || item.selectedIconPath)
52
+ }"
53
+ :style="{ color: elColor(index), fontSize: $u.addUnit(getTextSize(index)) }"
54
+ >
44
55
  <text class="u-line-1">{{ item.text }}</text>
45
56
  </view>
46
57
  </view>
@@ -240,6 +251,31 @@ function getOffsetRight(count: number, isDot: boolean): number {
240
251
  }
241
252
  }
242
253
 
254
+ /**
255
+ * 获取单项icon尺寸(单项优先级高于props)
256
+ */
257
+ function getIconSize(index: number) {
258
+ const item = props.list[index] || {};
259
+ if (props.midButton && item.midButton) {
260
+ return props.midButtonSize;
261
+ }
262
+ if (item.iconSize !== undefined && item.iconSize !== null && item.iconSize !== '') {
263
+ return item.iconSize;
264
+ }
265
+ return props.iconSize;
266
+ }
267
+
268
+ /**
269
+ * 获取单项text尺寸(单项优先级高于props)
270
+ */
271
+ function getTextSize(index: number) {
272
+ const item = props.list[index] || {};
273
+ if (item.textSize !== undefined && item.textSize !== null && item.textSize !== '') {
274
+ return item.textSize;
275
+ }
276
+ return props.textSize;
277
+ }
278
+
243
279
  /**
244
280
  * 获取凸起按钮外层元素的left值,让其水平居中
245
281
  */
@@ -302,6 +338,10 @@ function getMidButtonLeft() {
302
338
  left: 50%;
303
339
  transform: translateX(-50%);
304
340
  }
341
+ &__button--center {
342
+ top: 50%;
343
+ transform: translate(-50%, -50%);
344
+ }
305
345
  &__text {
306
346
  color: $u-content-color;
307
347
  font-size: 26rpx;
@@ -313,6 +353,11 @@ function getMidButtonLeft() {
313
353
  width: 100%;
314
354
  text-align: center;
315
355
  }
356
+ &__text--center {
357
+ top: 50%;
358
+ bottom: auto;
359
+ transform: translate(-50%, -50%);
360
+ }
316
361
  }
317
362
  &__circle {
318
363
  position: relative;
@@ -18,15 +18,16 @@
18
18
  background: delBgColor
19
19
  }"
20
20
  >
21
- <u-icon class="u-icon" :name="delIcon" size="20" :color="delColor"></u-icon>
21
+ <u-icon :name="delIcon" size="20" :color="delColor"></u-icon>
22
+ </view>
23
+ <view class="u-upload-progress">
24
+ <u-line-progress
25
+ v-if="showProgress && item.progress > 0 && item.progress != 100 && !item.error"
26
+ :show-percent="false"
27
+ height="16"
28
+ :percent="item.progress"
29
+ ></u-line-progress>
22
30
  </view>
23
- <u-line-progress
24
- v-if="showProgress && item.progress > 0 && item.progress != 100 && !item.error"
25
- :show-percent="false"
26
- height="16"
27
- class="u-progress"
28
- :percent="item.progress"
29
- ></u-line-progress>
30
31
  <view @tap.stop="retry(index)" v-if="item.error" class="u-error-btn">点击重试</view>
31
32
  <image
32
33
  @tap.stop="doPreviewImage(item.url || item.path, index)"
@@ -539,13 +540,7 @@ defineExpose({ clear, reUpload, selectFile, upload, retry, remove, doPreviewImag
539
540
  justify-content: center;
540
541
  }
541
542
 
542
- .u-icon {
543
- @include vue-flex;
544
- align-items: center;
545
- justify-content: center;
546
- }
547
-
548
- .u-progress {
543
+ .u-upload-progress {
549
544
  position: absolute;
550
545
  bottom: 10rpx;
551
546
  left: 8rpx;
@@ -19,9 +19,16 @@ export interface RequestConfig {
19
19
  method?: string;
20
20
  dataType?: string;
21
21
  responseType?: string;
22
+ timeout?: number;
22
23
  meta?: RequestMeta;
24
+ [key: string]: any;
23
25
  }
24
26
 
27
+ /**
28
+ * 忽略的请求参数类型定义
29
+ */
30
+ const IGNORE_REQUEST_KEYS = ['baseUrl', 'meta'];
31
+
25
32
  /**
26
33
  * 请求拦截器类型定义
27
34
  */
@@ -43,6 +50,7 @@ export interface RequestOptions {
43
50
  params?: Record<string, any>;
44
51
  complete?: (response: any) => void;
45
52
  meta?: RequestMeta;
53
+ [key: string]: any;
46
54
  }
47
55
 
48
56
  export class Request {
@@ -57,6 +65,7 @@ export class Request {
57
65
  method: 'POST', // 请求方式
58
66
  dataType: 'json', // 设置为json,返回后uni.request会对数据进行一次JSON.parse
59
67
  responseType: 'text', // 此参数无需处理,因为5+和支付宝小程序不支持,默认为text即可
68
+ timeout: 60000,
60
69
  meta: {
61
70
  originalData: true, // 是否在拦截器中返回服务端的原始数据,见文档说明
62
71
  toast: false, // 是否在请求出错时,弹出toast
@@ -68,6 +77,65 @@ export class Request {
68
77
  response: null
69
78
  };
70
79
  }
80
+ /**
81
+ * 将全局配置合并到本次请求的 options 中
82
+ * - 忽略 IGNORE_REQUEST_KEYS 中的字段(如 meta)
83
+ * - 对 header 使用深合并(全局 header 为默认,options.header 优先)
84
+ * - 对对象类型的字段尝试深合并,基础类型以 options 值优先
85
+ * - 处理 baseUrl:若存在全局 baseUrl 且 options.url 非完整 url(非 http 开头),则合并成完整 URL
86
+ */
87
+ private mergeGlobalConfigToOptions(options: RequestOptions): RequestOptions {
88
+ const mergedOptions: RequestOptions = { ...options };
89
+ for (const key of Object.keys(this.config)) {
90
+ if (IGNORE_REQUEST_KEYS.includes(key)) {
91
+ continue;
92
+ }
93
+ const cfgVal = this.config[key];
94
+ const optVal = options[key];
95
+
96
+ // 跳过未设置的全局配置
97
+ if (cfgVal === undefined) continue;
98
+
99
+ // header 需要做深合并,且以 options.header 为准覆盖同名属性
100
+ if (key === 'header') {
101
+ mergedOptions.header = deepMerge(cfgVal || {}, optVal || {});
102
+ continue;
103
+ }
104
+
105
+ // 针对 method 等枚举字符串,优先使用 options 中的值,否则使用全局配置
106
+ if (typeof cfgVal === 'string' || typeof cfgVal === 'number' || typeof cfgVal === 'boolean') {
107
+ mergedOptions[key] = optVal !== undefined ? optVal : cfgVal;
108
+ continue;
109
+ }
110
+
111
+ // 对对象类型的配置(如自定义扩展)尝试做深合并
112
+ if (typeof cfgVal === 'object' && !Array.isArray(cfgVal)) {
113
+ mergedOptions[key] = deepMerge(cfgVal || {}, optVal || {});
114
+ continue;
115
+ }
116
+
117
+ // 其他类型,若 options 未传入则使用全局配置
118
+ if (optVal === undefined) {
119
+ mergedOptions[key] = cfgVal;
120
+ }
121
+ }
122
+ // 如果存在 baseUrl,并且 options.url 为相对地址,则拼接成完整 url
123
+ const baseUrl = this.config.baseUrl;
124
+ if (
125
+ baseUrl &&
126
+ mergedOptions.url &&
127
+ typeof mergedOptions.url === 'string' &&
128
+ mergedOptions.url.indexOf('http') !== 0
129
+ ) {
130
+ mergedOptions.url =
131
+ baseUrl + (mergedOptions.url.indexOf('/') === 0 ? mergedOptions.url : `/${mergedOptions.url}`);
132
+ }
133
+ // 确保 url 存在,且为 string
134
+ if (!mergedOptions.url) {
135
+ mergedOptions.url = '';
136
+ }
137
+ return mergedOptions;
138
+ }
71
139
  /**
72
140
  * 设置全局默认配置
73
141
  * @param customConfig 自定义配置
@@ -88,14 +156,10 @@ export class Request {
88
156
  };
89
157
  // 让 options.meta 传递到拦截器
90
158
  options.meta = mergedMeta;
91
- options.dataType = options.dataType || this.config.dataType;
92
- options.responseType = options.responseType || this.config.responseType;
93
159
  options.url = options.url || '';
94
160
  options.params = options.params || {};
95
- options.header = Object.assign({}, this.config.header || {}, options.header || {});
96
- options.method = (options.method || this.config.method) as RequestOptions['method'];
97
- // 保证 url 一定为 string
98
- if (!options.url) options.url = '';
161
+ // 将全局配置合并到本次请求 options 中(注意忽略一些特殊字段如 baseUrl/meta)
162
+ options = this.mergeGlobalConfigToOptions(options);
99
163
 
100
164
  if (this.interceptor.request && typeof this.interceptor.request === 'function') {
101
165
  const interceptorRequest = this.interceptor.request(options);
@@ -146,11 +210,6 @@ export class Request {
146
210
  }
147
211
  }
148
212
  };
149
- // 判断用户传递的URL是否http开头
150
- options.url =
151
- options.url && options.url.indexOf('http') !== 0
152
- ? this.config.baseUrl + (options.url.indexOf('/') === 0 ? options.url : `/${options.url}`)
153
- : options.url;
154
213
  uni.request(options);
155
214
  });
156
215
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "uview-pro",
3
3
  "name": "uview-pro",
4
4
  "displayName": "【支持鸿蒙】uView Pro|基于Vue3+TS的80+精选UI组件库,支持多主题,暗黑模式",
5
- "version": "0.4.8",
5
+ "version": "0.4.10",
6
6
  "description": "uView Pro,是全面支持Vue3+TS的uni-app生态框架,80+精选组件,支持安卓,iOS,鸿蒙,各小程序平台,支持多主题,一键暗黑模式",
7
7
  "main": "index.ts",
8
8
  "module": "index.ts",
package/readme.md CHANGED
@@ -90,7 +90,7 @@ pnpm dev
90
90
 
91
91
  开源不易,如果您认为 `uView Pro` 帮到了您的开发工作,您可以捐赠 `uView Pro`:
92
92
 
93
- [欢迎捐赠留名](https://uviewpro.cn/zh/resource/donation.html)
93
+ [欢迎捐赠留名](https://uviewpro.cn/zh/reward/donation.html)
94
94
 
95
95
  ## 关于 PR
96
96
 
package/types/global.d.ts CHANGED
@@ -403,4 +403,6 @@ export type TabbarItem = {
403
403
  isDot?: boolean;
404
404
  customIcon?: boolean | string;
405
405
  midButton?: boolean;
406
+ iconSize?: string | number;
407
+ textSize?: string | number;
406
408
  };