Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

表单验证,按规则来配置字段 vs 按字段配置规则

$
0
0

按规则配置字段

var validRule=[
'require':['email','password'],
'email':['email'],
...
];

分字段配置规则

var validFields=[
'username':['require'],
'password':['require'],
'email':['email']
]

表单验证这两种方式那种更好一些?


Viewing all articles
Browse latest Browse all 14821

Trending Articles