Skip to content

Commit

Permalink
fix user-dashboard edit age bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jerexyz committed Oct 26, 2016
1 parent 585fd8c commit 9e54fde
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/user-dashboard/src/components/Users/UserModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ const UserModal = ({
}

function checkNumber(rule, value, callback) {
if (!value) {
callback(new Error('年龄未填写'));
}
if (!/^[\d]{1,2}$/.test(value)) {
callback(new Error('年龄不合法'));
} else {
Expand Down Expand Up @@ -72,7 +75,6 @@ const UserModal = ({
{getFieldDecorator('age', {
initialValue: item.age,
rules: [
{ required: true, message: '年龄未填写' },
{ validator: checkNumber },
],
})(
Expand Down

0 comments on commit 9e54fde

Please sign in to comment.