Skip to content

Commit

Permalink
fix(uni-forms): 修复 model 需要校验的值没有声明对应字段时,导致第一次不触发校验的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mehaotian committed Jul 15, 2022
1 parent 023dfea commit 4f346fe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions uni_modules/uni-forms/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 1.4.6(2022-07-13)
- 修复 model 需要校验的值没有声明对应字段时,导致第一次不触发校验的bug
## 1.4.5(2022-07-05)
- 新增 更多表单示例
- 优化 子表单组件过期提示的问题
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@
(value, oldVal) => {
const isEqual = this.form._isEqual(value, oldVal)
// 简单判断前后值的变化,只有发生变化才会发生校验
// TODO 如果 oldVal = undefined ,那么大概率是源数据里没有值导致 ,这个情况不哦校验 ,可能不严谨 ,需要在做观察
if (!isEqual && oldVal !== undefined) {
// TODO 如果 oldVal = undefined ,那么大概率是源数据里没有值导致 ,这个情况不哦校验 ,可能不严谨 ,需要在做观察
// fix by mehaotian 暂时取消 && oldVal !== undefined ,如果formData 中不存在,可能会不校验
if (!isEqual) {
const val = this.itemSetValue(value)
this.onFieldChange(val, false)
}
Expand Down
5 changes: 3 additions & 2 deletions uni_modules/uni-forms/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "uni-forms",
"displayName": "uni-forms 表单",
"version": "1.4.5",
"version": "1.4.6",
"description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据",
"keywords": [
"uni-ui",
Expand Down Expand Up @@ -74,7 +74,8 @@
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
"QQ": "y",
"京东": "u"
},
"快应用": {
"华为": "u",
Expand Down

0 comments on commit 4f346fe

Please sign in to comment.