From 16213c0f85aa3ac8317797bf4a05fd12940e16d3 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期三, 05 三月 2025 17:29:42 +0800
Subject: [PATCH] -

---
 src/uni_modules/uview-plus/components/u-form/u-form.vue |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/uni_modules/uview-plus/components/u-form/u-form.vue b/src/uni_modules/uview-plus/components/u-form/u-form.vue
index bcbdb9f..f58e818 100644
--- a/src/uni_modules/uview-plus/components/u-form/u-form.vue
+++ b/src/uni_modules/uview-plus/components/u-form/u-form.vue
@@ -126,7 +126,7 @@
 				});
 			},
 			// 瀵归儴鍒嗚〃鍗曞瓧娈佃繘琛屾牎楠�
-			async validateField(value, callback, event = null) {
+			async validateField(value, callback, event = null,options) {
 				// $nextTick鏄繀椤荤殑锛屽惁鍒檓odel鐨勫彉鏇达紝鍙兘浼氬欢鍚庝簬姝ゆ柟娉曠殑鎵ц
 				this.$nextTick(() => {
 					// 鏍¢獙閿欒淇℃伅锛岃繑鍥炵粰鍥炶皟鏂规硶锛岀敤浜庡瓨鏀炬墍鏈塮orm-item鐨勯敊璇俊鎭�
@@ -191,9 +191,11 @@
 												errorsRes.push(...errors);
 												childErrors.push(...errors);
 											}
-											child.message =
-												childErrors[0]?.message ? childErrors[0].message : null;
-
+											//娌℃湁閰嶇疆锛屾垨鑰呴厤缃簡showErrorMsg涓簍rue鏃跺�欙紝鎵嶄慨鏀瑰瓙缁勪欢message锛岄粯璁ゆ病鏈夐厤缃�
+											if(!options||options?.showErrorMsg==true){
+												child.message =
+													childErrors[0]?.message ? childErrors[0].message : null;
+											}
 											if (i == (rules.length - 1)) {
 												resolve(errorsRes)
 											}
@@ -217,8 +219,12 @@
 						});
 				});
 			},
-			// 鏍¢獙鍏ㄩ儴鏁版嵁
-			validate(callback) {
+			/**
+			 * 鏍¢獙鍏ㄩ儴鏁版嵁
+			 * @param {Object} options
+			 * @param {Boolean} options.showErrorMsg -鏄惁鏄剧ず鏍¢獙淇℃伅锛�
+			 */
+			validate(options) {
 				// 寮�鍙戠幆澧冩墠鎻愮ず锛岀敓浜х幆澧冧笉浼氭彁绀�
 				if (process.env.NODE_ENV === 'development' && Object.keys(this.formRules).length === 0) {
 					error('鏈缃畆ules锛岃鐪嬫枃妗h鏄庯紒濡傛灉宸茬粡璁剧疆锛岃鍒锋柊椤甸潰銆�');
@@ -240,7 +246,7 @@
 							} else {
 								resolve(true)
 							}
-						});
+						},null,options);
 					});
 				});
 			},

--
Gitblit v1.9.1