From ec90cbd7680a6f927cb1cea43f33ab7df6d0864c Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期二, 11 十一月 2025 09:23:22 +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