-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
验证数组的时候出来的是'[object Object]',而不是数组的值 #5
Comments
其实之前这个 array 是专门指用英文逗号分隔的字符串数组,因为这个参数验证主要考虑了接口的参数验证,这个是设计给 query 参数用的。 ctx.validate({
id: { type: 'string', required: true, range: { min: 1, max: 30 }, desc: '必须要有id' },
wordsList: {
type: 'json',
desc: '数组错误',
range: {
schema: {
type : 'array',
}
}
},
}); 我也想了下这个确实容易引起歧义 ctx.validate({
id: { type: 'string', required: true, range: { min: 1, max: 30 }, desc: '必须要有id' },
wordsList: { type: 'array', desc: '数组错误' },
}); 也能识别处理你这样的参数传入(即支持 英文逗号分隔的字符串数组、数组对象、JSON 数组对象) |
@D780 对于 ids: [1,2,3] 如何验证参数为 int 类型?不是特别理解 希望获得解答。 |
针对这个一般有两种方式
|
待验证的表单
save2server---form>
验证代码
console.log结果
如果不用验证的时候是正常的
验证代码
console.log结果
请问要怎么做才能正确返回数组对象呢?
The text was updated successfully, but these errors were encountered: