2***@qq.com
2***@qq.com
  • 发布:2025-09-14 11:29
  • 更新:2025-09-15 14:24
  • 阅读:39

关于 uniCloud,设置minLength和maxLength限制后的提示问题

分类:uniCloud

产品分类: uniCloud/App

操作步骤:

// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema
{
"bsonType": "object",
"required": ["age", "name"],
"permission": {
"read": true,
"create": true,
"update": true,
"delete": true
},
"properties": {
"_id": {
"description": "ID,系统自动生成"
},
"name": {
"title": "姓名",
"description": "请输入姓名",
"label": "名字",
"bsonType": "string",
"minLength": 2,
"maxLength": 5,
"errorMessage": {
"required": "{label}必填",
"minLength": "{label}不能小于{minLength}个字符",
"maxLength": "{label}不能大于{maxLength}个字符"
}
},
"age": {
"title": "年龄",
"description": "请输入年龄",
"bsonType": "int"
},
"gender": {
"bsonType": "int",
"title": "性别",
"defaultValue": 0,
"enum": [{
"text": "保密",
"value": 0
},
{
"text": "男",
"value": 1
},
{
"text": "女",
"value": 2
}
]
},
"createTime": {
"title": "时间",
"bsonType": "timestamp",
"defaultValue": {
"$env": "now"
}
},
"ip": {
"title": "IP地址",
"bsonType": "string",
"forceDefaultValue": {
"$env": "clientIP"
}
}
}
}

预期结果:

名字填写超过5个字符应该显示名字不能大于5个字符

实际结果:

名字填写超过5个字符后,页面showLoading 弹出的提示为“名字不能小于2个字符”

bug描述:

"name": {
"title": "姓名",
"description": "请输入姓名",
"label": "名字",
"bsonType": "string",
"minLength": 2,
"maxLength": 5,
"errorMessage": {
"required": "{label}必填",
"minLength": "{label}不能小于{minLength}个字符",
"maxLength": "{label}不能大于{maxLength}个字符"
}
},
这样写结构,在页面填写了6个字符后,还是会显示提示“不能小于2个字符”

2025-09-14 11:29 负责人:无 分享
已邀请:
DCloud_uniCloud_VK

DCloud_uniCloud_VK

你上传了吗?

要回复问题请先登录注册