uview-pro 0.6.20 → 0.6.21

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,3 +1,13 @@
1
+ ## 0.6.21(2026-10-10)
2
+
3
+ ### ✨ Features | 新功能
4
+
5
+ - **divider:** 新增 dashed 属性支持虚线 ([240432b](https://github.com/anyup/uView-Pro/commit/240432bc774f4b4d2cd64297de1762a1ea94d2bd))
6
+
7
+ ### 🐛 Bug Fixes | Bug 修复
8
+
9
+ - **u-tabs-swiper:** 修复 setDx 在 tabsInfo 未初始化时访问 undefined 导致报错 ([a581f97](https://github.com/anyup/uView-Pro/commit/a581f972bc6569557b765f8ed15c65d1bb254fda))
10
+
1
11
  ## 0.6.20(2026-09-20)
2
12
 
3
13
  ### 🐛 Bug Fixes | Bug 修复
@@ -35,7 +35,9 @@ export const DividerProps = {
35
35
  /** 下边距 */
36
36
  marginBottom: { type: [String, Number] as PropType<string | number>, default: 0 },
37
37
  /** 是否使用slot传入内容,如果不用slot传入内容,先的中间就不会有空隙 */
38
- useSlot: { type: Boolean, default: true }
38
+ useSlot: { type: Boolean, default: true },
39
+ /** 是否虚线 */
40
+ dashed: { type: Boolean, default: false }
39
41
  };
40
42
 
41
43
  export type DividerProps = ExtractPropTypes<typeof DividerProps>;
@@ -68,6 +68,7 @@ import { $u } from '../../';
68
68
  * @property {String Number} height 整个divider的高度,单位rpx(默认40)
69
69
  * @property {String} type 将线条设置主题色(默认primary)
70
70
  * @property {Boolean} useSlot 是否使用slot传入内容,如果不传入,中间不会有空隙(默认true)
71
+ * @property {Boolean} dashed 是否虚线(默认false)
71
72
  * @property {String Number} margin-top 与前一个组件的距离,单位rpx(默认0)
72
73
  * @property {String Number} margin-bottom 与后一个组件的距离,单位rpx(0)
73
74
  * @event {Function} click divider组件被点击时触发
@@ -86,6 +87,8 @@ const lineStyle = computed(() => {
86
87
  else style.width = props.halfWidth + 'rpx';
87
88
  // borderColor优先级高于type值
88
89
  if (props.borderColor) style.borderColor = props.borderColor;
90
+ // 虚线
91
+ if (props.dashed) style.borderStyle = 'dashed';
89
92
  return style;
90
93
  });
91
94
 
@@ -228,6 +228,11 @@ function getQuery(cb?: (data: any) => void) {
228
228
 
229
229
  // 颜色渐变tab滑动
230
230
  function setDx(dx: number) {
231
+ // 防止 tabsInfo 尚未初始化完成时访问未定义元素导致的报错:
232
+ // init() 中 getTabsInfo() 为异步(依赖 SelectorQuery 回调填充 tabsInfo),
233
+ // 若 swiper 的 transition 事件早于节点查询完成触发,tabsInfo 仍为空数组,
234
+ // 此时直接读取 tabsInfo.value[index].left 会抛出 "Cannot read property 'left' of undefined"
235
+ if (tabsInfo.value.length === 0) return;
231
236
  let nextTabIndex = dx > 0 ? animationFinishCurrent.value + 1 : animationFinishCurrent.value - 1;
232
237
  // 判断索引是否超出边界
233
238
  nextTabIndex = nextTabIndex <= 0 ? 0 : nextTabIndex;
@@ -235,6 +240,8 @@ function setDx(dx: number) {
235
240
  const tab = tabsInfo.value[nextTabIndex];
236
241
  // 当前tab中心点x轴坐标
237
242
  const nowTab = tabsInfo.value[animationFinishCurrent.value];
243
+ // 若当前或目标 tab 的节点信息尚未获取到,跳过本次渐变计算,等待下一次 transition 事件
244
+ if (!tab || !nowTab) return;
238
245
  const nowTabX = nowTab.left + nowTab.width / 2;
239
246
  // 下一个tab
240
247
  const nextTabX = tab.left + tab.width / 2;
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的高质量UI组件库,支持多主题、暗黑模式、多语言",
5
- "version": "0.6.20",
5
+ "version": "0.6.21",
6
6
  "description": "uView Pro是基于Vue3+TS的多平台UI框架,提供80+高质量组件、便捷工具和常用模板,支持多主题、暗黑模式、多语言,支持H5/APP/鸿蒙/小程序多端开发。已在鸿蒙应用商店上架,欢迎体验!",
7
7
  "main": "index.ts",
8
8
  "module": "index.ts",