uview-pro 0.6.19-rc.0 → 0.6.20
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 +22 -0
- package/components/u-count-down/u-count-down.vue +15 -2
- package/components/u-form/u-form.vue +40 -0
- package/components/u-input/u-input.vue +1 -1
- package/components/u-time-line-item/types.ts +1 -1
- package/components/u-time-line-item/u-time-line-item.vue +1 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## 0.6.20(2026-09-20)
|
|
2
|
+
|
|
3
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
4
|
+
|
|
5
|
+
- **u-time-line:** 修改节点默认背景色为透明 ([be7a591](https://github.com/anyup/uView-Pro/commit/be7a591b6357dc55739487d78334cae896d976bc))
|
|
6
|
+
- **u-input:** 圆角与边框解耦,不传border时同样有圆角 ([2bfb23e](https://github.com/anyup/uView-Pro/commit/2bfb23eb048328ee218efc8e3d3b556111872b54))
|
|
7
|
+
- **u-count-down:** 修复组件卸载后定时器残留泄漏问题,另新增destroy暴露方法用于主动停止倒计时并清理定时器 ([ad596c4](https://github.com/anyup/uView-Pro/commit/ad596c43db06be8853606d8ac5e6f4f66768c055))
|
|
8
|
+
|
|
9
|
+
### 👥 Contributors
|
|
10
|
+
|
|
11
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
12
|
+
|
|
13
|
+
## 0.6.19(2026-09-07)
|
|
14
|
+
|
|
15
|
+
### ✨ Features | 新功能
|
|
16
|
+
|
|
17
|
+
- **u-form:** 新增validateField表单校验方法,支持单个或多个字段校验(#180) ([9e77c3a](https://github.com/anyup/uView-Pro/commit/9e77c3a0dd099f831b8dccbc9e203dd433ecfda2))
|
|
18
|
+
|
|
19
|
+
### 👥 Contributors
|
|
20
|
+
|
|
21
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
22
|
+
|
|
1
23
|
## 0.6.18(2026-09-03)
|
|
2
24
|
|
|
3
25
|
### 🐛 Bug Fixes | Bug 修复
|
|
@@ -81,7 +81,7 @@ export default {
|
|
|
81
81
|
</script>
|
|
82
82
|
|
|
83
83
|
<script setup lang="ts">
|
|
84
|
-
import { ref, computed, watch, onMounted } from 'vue';
|
|
84
|
+
import { ref, computed, watch, onMounted, onUnmounted } from 'vue';
|
|
85
85
|
import { CountDownProps } from './types';
|
|
86
86
|
import { $u, useLocale } from '../../';
|
|
87
87
|
|
|
@@ -170,6 +170,11 @@ onMounted(() => {
|
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
|
|
173
|
+
// 组件销毁时清理定时器,避免定时器残留造成泄漏
|
|
174
|
+
onUnmounted(() => {
|
|
175
|
+
clearTimer();
|
|
176
|
+
});
|
|
177
|
+
|
|
173
178
|
/**
|
|
174
179
|
* 倒计时
|
|
175
180
|
*/
|
|
@@ -240,9 +245,17 @@ function clearTimer() {
|
|
|
240
245
|
}
|
|
241
246
|
}
|
|
242
247
|
|
|
248
|
+
/**
|
|
249
|
+
* 销毁倒计时:清除定时器且不触发 end 事件,用于主动销毁/停止倒计时
|
|
250
|
+
*/
|
|
251
|
+
function destroy() {
|
|
252
|
+
clearTimer();
|
|
253
|
+
}
|
|
254
|
+
|
|
243
255
|
defineExpose({
|
|
244
256
|
start,
|
|
245
|
-
end
|
|
257
|
+
end,
|
|
258
|
+
destroy
|
|
246
259
|
});
|
|
247
260
|
</script>
|
|
248
261
|
|
|
@@ -113,10 +113,50 @@ function validate(callback?: (valid: boolean, errorArr: ErrorItem[]) => void): P
|
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/**
|
|
117
|
+
* 校验指定字段(支持单个字段名或字段名数组)
|
|
118
|
+
* @param prop 字段名(对应 u-form-item 的 prop),可传字符串或数组
|
|
119
|
+
* @param callback 校验回调,参数为 (valid: boolean, errorArr: ErrorItem[])
|
|
120
|
+
* @returns Promise<boolean>
|
|
121
|
+
*/
|
|
122
|
+
function validateField(
|
|
123
|
+
prop: string | string[],
|
|
124
|
+
callback?: (valid: boolean, errorArr: ErrorItem[]) => void
|
|
125
|
+
): Promise<boolean> {
|
|
126
|
+
const props = Array.isArray(prop) ? prop : [prop];
|
|
127
|
+
// 从 fields 中精确匹配指定 prop
|
|
128
|
+
const targetFields = fields.value.filter((field: any) => props.indexOf(field.prop) !== -1);
|
|
129
|
+
|
|
130
|
+
return new Promise(resolve => {
|
|
131
|
+
let valid = true;
|
|
132
|
+
let count = 0;
|
|
133
|
+
let errorArr: ErrorItem[] = [];
|
|
134
|
+
if (targetFields.length === 0) {
|
|
135
|
+
resolve(true);
|
|
136
|
+
if (typeof callback === 'function') callback(true, []);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
targetFields.forEach((field: any) => {
|
|
140
|
+
// 复用 u-form-item 的 validation,确保其自身错误状态被更新/清除
|
|
141
|
+
field.validation('', (error: any) => {
|
|
142
|
+
if (error) {
|
|
143
|
+
valid = false;
|
|
144
|
+
errorArr.push({ prop: field.prop, message: error });
|
|
145
|
+
}
|
|
146
|
+
if (++count === targetFields.length) {
|
|
147
|
+
resolve(valid);
|
|
148
|
+
if (typeof callback === 'function') callback(valid, errorArr);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
116
155
|
defineExpose({
|
|
117
156
|
setRules,
|
|
118
157
|
resetFields,
|
|
119
158
|
validate,
|
|
159
|
+
validateField,
|
|
120
160
|
addField(field: any) {
|
|
121
161
|
if (!fields.value.includes(field)) fields.value.push(field);
|
|
122
162
|
},
|
|
@@ -361,6 +361,7 @@ defineExpose({
|
|
|
361
361
|
flex: 1;
|
|
362
362
|
@include vue-flex;
|
|
363
363
|
align-items: center;
|
|
364
|
+
border-radius: 4px;
|
|
364
365
|
|
|
365
366
|
&__readonly-overlay {
|
|
366
367
|
position: absolute;
|
|
@@ -410,7 +411,6 @@ defineExpose({
|
|
|
410
411
|
}
|
|
411
412
|
|
|
412
413
|
&--border {
|
|
413
|
-
border-radius: 4px;
|
|
414
414
|
border: 1px solid $u-border-color;
|
|
415
415
|
}
|
|
416
416
|
|
|
@@ -16,7 +16,7 @@ export const TimeLineItemProps = {
|
|
|
16
16
|
default: ''
|
|
17
17
|
},
|
|
18
18
|
/** 节点的背景颜色 */
|
|
19
|
-
bgColor: { type: String, default: '
|
|
19
|
+
bgColor: { type: String, default: 'transparent' },
|
|
20
20
|
/** 节点左边图标绝对定位的top值,单位rpx */
|
|
21
21
|
nodeTop: { type: [String, Number] as PropType<string | number>, default: '' }
|
|
22
22
|
};
|
|
@@ -31,7 +31,7 @@ import { $u } from '../../';
|
|
|
31
31
|
* timeLineItem 时间轴Item
|
|
32
32
|
* @description 时间轴组件一般用于物流信息展示,各种跟时间相关的记录等场景。(搭配u-time-line使用)
|
|
33
33
|
* @tutorial https://uviewpro.cn/zh/components/timeLine.html
|
|
34
|
-
* @property {String} bg-color 左边节点的背景颜色,一般通过slot内容自定义背景颜色即可(默认
|
|
34
|
+
* @property {String} bg-color 左边节点的背景颜色,一般通过slot内容自定义背景颜色即可(默认transparent)
|
|
35
35
|
* @property {String | Number} node-top 节点左边图标绝对定位的top值,单位rpx
|
|
36
36
|
* @example <u-time-line-item node-top="2">...</u-time-line-item>
|
|
37
37
|
*/
|
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.
|
|
5
|
+
"version": "0.6.20",
|
|
6
6
|
"description": "uView Pro是基于Vue3+TS的多平台UI框架,提供80+高质量组件、便捷工具和常用模板,支持多主题、暗黑模式、多语言,支持H5/APP/鸿蒙/小程序多端开发。已在鸿蒙应用商店上架,欢迎体验!",
|
|
7
7
|
"main": "index.ts",
|
|
8
8
|
"module": "index.ts",
|