Skip to content

Commit ab600b9

Browse files
fix: 🐛 修复Form指定prop为a.b时校验失败的问题 (#329)
当prop为多级嵌套结构时,正则或者自定义校验器时,无法获取对应的输入值 Co-authored-by: jinmuyan5393 <jinmuyan5393@163.com>
1 parent efd55ca commit ab600b9

File tree

1 file changed

+2
-2
lines changed
  • src/uni_modules/wot-design-uni/components/wd-form

1 file changed

+2
-2
lines changed

src/uni_modules/wot-design-uni/components/wd-form/wd-form.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async function validate(prop?: string): Promise<{ valid: boolean; errors: ErrorM
6161
valid = false
6262
break
6363
}
64-
if (rule.pattern && !rule.pattern.test(props.model[prop])) {
64+
if (rule.pattern && !rule.pattern.test(value)) {
6565
errors.push({
6666
prop,
6767
message: rule.message
@@ -71,7 +71,7 @@ async function validate(prop?: string): Promise<{ valid: boolean; errors: ErrorM
7171
}
7272
const { validator, ...ruleWithoutValidator } = rule
7373
if (validator) {
74-
const result = validator(props.model[prop], ruleWithoutValidator)
74+
const result = validator(value, ruleWithoutValidator)
7575
if (isPromise(result)) {
7676
promises.push(
7777
result

0 commit comments

Comments
 (0)