uview-pro 0.4.6 → 0.4.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.
package/changelog.md CHANGED
@@ -1,22 +1,41 @@
1
- ## 0.4.6(2025-12-17
1
+ ## 0.4.7(2025-12-19
2
2
 
3
- ### 📝 Documentation | 文档
3
+ ### 🚀 Chore | 构建/工程依赖/工具
4
4
 
5
- - 添加鸿蒙系统预览说明及二维码 ([7f6199a](https://github.com/anyup/uView-Pro/commit/7f6199a30d5477743c20b27a94711b4605787757))
5
+ - 忽略部分文件 ([a8a747f](https://github.com/anyup/uView-Pro/commit/a8a747f97e93ed278a305cd1b2671d2ede5c0fde))
6
6
 
7
7
  ### ✨ Features | 新功能
8
8
 
9
- - **u-slider:** 增强滑块组件功能与灵活性,支持设置滑块的整体范围起点(start)和终点(end) ([a20c44b](https://github.com/anyup/uView-Pro/commit/a20c44b0270cffde02afd8738a932b2d6bae49f4))
10
- - **button:** 新增按钮禁用与自定义样式功能演示 ([5f1f482](https://github.com/anyup/uView-Pro/commit/5f1f4823e027dc5ab2e6f49f29fe327c6d4318c6))
9
+ - **u-tabbar:** u-tabbar 组件支持 custom-icon 直接配置图标 custom-prefix ([e577c2d](https://github.com/anyup/uView-Pro/commit/e577c2d083cf46db7124b0df46b2848ef9bdbe80))
11
10
 
12
11
  ### 🐛 Bug Fixes | Bug 修复
13
12
 
14
- - **button:** 更新禁用状态下按钮样式优先级 ([b3ff20b](https://github.com/anyup/uView-Pro/commit/b3ff20b59818c8bc8204bb2a489eff42ded7e842))
13
+ - **u-icon:** 修复图标组件样式和事件处理问题 ([1cadf27](https://github.com/anyup/uView-Pro/commit/1cadf27f8bd2aec3a11fb1befb9255256a2e3b3a))
14
+ - **u-pagination:** 修复分页切换时传递不正确的当前页码值 ([4befe02](https://github.com/anyup/uView-Pro/commit/4befe02c5cbb4e7db6fbf49f04ca68fac0f69a37))
15
15
 
16
16
  ### 👥 Contributors
17
17
 
18
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>
19
19
 
20
+ ## 0.4.6(2025-12-17)
21
+
22
+ ### 📝 Documentation | 文档
23
+
24
+ - 添加鸿蒙系统预览说明及二维码 ([7f6199a](https://github.com/anyup/uView-Pro/commit/7f6199a30d5477743c20b27a94711b4605787757))
25
+
26
+ ### ✨ Features | 新功能
27
+
28
+ - **u-slider:** 增强滑块组件功能与灵活性,支持设置滑块的整体范围起点(start)和终点(end) ([a20c44b](https://github.com/anyup/uView-Pro/commit/a20c44b0270cffde02afd8738a932b2d6bae49f4))
29
+ - **button:** 新增按钮禁用与自定义样式功能演示 ([5f1f482](https://github.com/anyup/uView-Pro/commit/5f1f4823e027dc5ab2e6f49f29fe327c6d4318c6))
30
+
31
+ ### 🐛 Bug Fixes | Bug 修复
32
+
33
+ - **button:** 更新禁用状态下按钮样式优先级 ([b3ff20b](https://github.com/anyup/uView-Pro/commit/b3ff20b59818c8bc8204bb2a489eff42ded7e842))
34
+
35
+ ### 👥 Contributors
36
+
37
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
38
+
20
39
  ## 0.4.5(2025-12-10)
21
40
 
22
41
  ### ✨ Features | 新功能
@@ -1,17 +1,22 @@
1
1
  <template>
2
- <view :style="[customStyle]" class="u-icon" @click="onClick" :class="['u-icon--' + labelPos, customClass]">
3
- <image class="u-icon__img" v-if="isImg" :src="name" :mode="imgMode" :style="[imgStyle]" />
2
+ <view
3
+ :style="$u.toStyle(customStyle)"
4
+ class="u-icon"
5
+ @click="onClick"
6
+ :class="['u-icon--' + labelPos, customClass]"
7
+ >
8
+ <image class="u-icon__img" v-if="isImg" :src="props.name" :mode="imgMode" :style="[imgStyle]" />
4
9
  <text
5
10
  v-else
6
11
  class="u-icon__icon"
7
12
  :class="iconClass"
8
- :style="[iconStyle]"
13
+ :style="$u.toStyle(iconStyle)"
9
14
  :hover-class="hoverClass"
10
15
  @touchstart="onTouchstart"
11
16
  >
12
17
  <text
13
18
  v-if="showDecimalIcon"
14
- :style="[decimalIconStyle]"
19
+ :style="$u.toStyle(decimalIconStyle)"
15
20
  :class="decimalIconClass"
16
21
  :hover-class="hoverClass"
17
22
  class="u-icon__decimal"
@@ -219,8 +224,8 @@ function onClick(event: any) {
219
224
  * 图标触摸时触发
220
225
  * @emits touchstart(index)
221
226
  */
222
- function onTouchstart() {
223
- emit('touchstart', props.index);
227
+ function onTouchstart(event: any) {
228
+ emit('touchstart', props.index || event);
224
229
  }
225
230
  </script>
226
231
 
@@ -65,14 +65,15 @@ const totalPages = computed(() => {
65
65
 
66
66
  // 切换分页
67
67
  function handleChange(type: PaginationDirection) {
68
- if (type === 'prev') {
69
- current.value -= 1;
70
- } else {
71
- current.value += 1;
72
- }
68
+ // 先计算新值,确保获取到的是更新后的值
69
+ const newCurrent = type === 'prev' ? current.value - 1 : current.value + 1;
70
+
71
+ // 更新 current
72
+ current.value = newCurrent;
73
73
 
74
74
  // current为当前页,type值为:next/prev,表示点击的是上一页还是下一页
75
- emit('change', { type, current: current.value });
75
+ // 使用计算后的新值,而不是 current.value,避免异步更新导致的值不同步问题
76
+ emit('change', { type, current: newCurrent });
76
77
  }
77
78
  </script>
78
79
 
@@ -31,7 +31,7 @@
31
31
  :name="elIconPath(index)"
32
32
  img-mode="scaleToFill"
33
33
  :color="elColor(index)"
34
- :custom-prefix="item.customIcon ? 'custom-icon' : 'uicon'"
34
+ :custom-prefix="getCustomPrefix(index)"
35
35
  ></u-icon>
36
36
  <u-badge
37
37
  :count="item.count"
@@ -154,6 +154,34 @@ const elColor = computed<(index: number) => string>(() => {
154
154
  };
155
155
  });
156
156
 
157
+ /**
158
+ * 计算当前item的custom-prefix
159
+ * customIcon为boolean时:true为"custom-icon",false为"uicon"
160
+ * customIcon为string时:直接使用该值
161
+ * customIcon为空时:默认"uicon"
162
+ */
163
+ function getCustomPrefix(index: number): string {
164
+ const customIcon = props.list[index]?.customIcon;
165
+
166
+ // 如果为空(undefined/null),返回默认值
167
+ if (customIcon === undefined || customIcon === null || customIcon === '') {
168
+ return 'uicon';
169
+ }
170
+
171
+ // 如果是字符串类型,直接返回
172
+ if (typeof customIcon === 'string') {
173
+ return customIcon;
174
+ }
175
+
176
+ // 如果是boolean类型
177
+ if (typeof customIcon === 'boolean') {
178
+ return customIcon ? 'custom-icon' : 'uicon';
179
+ }
180
+
181
+ // 默认返回uicon
182
+ return 'uicon';
183
+ }
184
+
157
185
  /**
158
186
  * 点击tabbar item
159
187
  */
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.6",
5
+ "version": "0.4.7",
6
6
  "description": "uView Pro,是全面支持Vue3+TS的uni-app生态框架,80+精选组件,支持安卓,iOS,鸿蒙,各小程序平台,支持多主题,一键暗黑模式",
7
7
  "main": "index.ts",
8
8
  "module": "index.ts",
package/types/global.d.ts CHANGED
@@ -401,6 +401,6 @@ export type TabbarItem = {
401
401
  selectedIconPath?: string;
402
402
  count?: number;
403
403
  isDot?: boolean;
404
- customIcon?: boolean;
404
+ customIcon?: boolean | string;
405
405
  midButton?: boolean;
406
406
  };