Skip to content

Commit 66867ac

Browse files
author
cunjinli
committed
fix #32
1 parent 97d94f9 commit 66867ac

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/form/form.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Component({
142142
const newErrors = []
143143
this.data.rules.forEach(rule => {
144144
if (errors[rule.name]) {
145-
errors.name = rule.name
145+
errors[rule.name].name = rule.name
146146
newErrors.push(errors[rule.name])
147147
}
148148
})

tools/demo/example/form/form.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ Component({
4141
}, {
4242
name: 'checkbox',
4343
rules: {required: true, message: '多选列表是必选项'},
44+
}, {
45+
name: 'name',
46+
rules: {required: true, message: '请输入姓名'},
4447
}, {
4548
name: 'qq',
4649
rules: {required: true, message: 'qq必填'},

tools/demo/example/form/form.wxml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
</mp-cells>
2020

2121
<mp-cells title="表单" footer="底部说明文字底部说明文字">
22+
<mp-cell prop="name" title="姓名" ext-class="">
23+
<input bindinput="formInputChange" data-field="name" class="weui-input" placeholder="请输入姓名"/>
24+
</mp-cell>
2225
<mp-cell prop="qq" title="qq" ext-class="">
2326
<input bindinput="formInputChange" data-field="qq" class="weui-input" placeholder="请输入qq"/>
2427
</mp-cell>

0 commit comments

Comments
 (0)