我刚开始学习HBuilderX设计uniCloud程序,我已经开通了服务空间,用的是阿里云,在阿里云数据库创建了集合students,其中一个字段:
"create_date": {
"rules": [
{
"format": "date"
}
]
}
schema2code生成add页面,与该字段对应的代码:
<uni-forms-item name="create_date" label="">
<uni-datetime-picker return-type="date" v-model="formData.create_date" placeholder="选择入学时间" @change="onChangeDateTime"></uni-datetime-picker>
其它自动生成的程序未动,但提交时提示:["create_date"]类型无效
检查validator代码:
"create_date": {
"rules": [
{
"format": "date"
}
]
}
测试在onChangeDateTime(e)中修改各种格式均未解决问题,寻求解决办法。

y***@126.com
- 发布:2024-06-30 16:36
- 更新:2024-07-30 23:04
- 阅读:222

你可以尝试修改 uni-datetime-picker return-type="date"
中的return-type ,改为string,见文档:uni-datetime-picker - props
y***@126.com (作者)
首先规则是schema2code自动生成的,我也曾手动改成"string",结果仍是报相同错误。而且发现在web管理页面数据库管理页直接修改该字段值,输入什么字符串(故意输入几个毫无意义的英文字母)都能正常保存,不知为啥不校验。就是在add.vue页面提交就报错。
2024-07-01 22:03