Skip to content

Commit

Permalink
fix: form组件移除无效样式
Browse files Browse the repository at this point in the history
  • Loading branch information
kongjing@dian.so authored and kongjing@dian.so committed Oct 26, 2022
1 parent 290338c commit 250ab14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 0 additions & 5 deletions packages/vantui/src/form-item/index.less
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
@import '../style/var.less';

.vant-form-formItem:last-child {
border-bottom: none;
}

/* stylelint-disable-next-line no-descending-specificity */
.vant-form-formItem {
line-height: @form-line-height;
Expand All @@ -13,7 +9,6 @@
margin: 0 @form-space-horizontal;
padding: @form-space-vertical 0;
background-color: @form-background-color;
border-bottom: @form-border-bottom;

&-wrapper {
background-color: @form-background-color;
Expand Down
9 changes: 8 additions & 1 deletion packages/vantui/src/form/core/formstore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,19 @@ class FormStore {
if (value || value === 0) {
if (isReg(rule)) {
status = rule.test(value) ? 'resolve' : 'reject'
if (status === 'reject') this.model[name].message = message
if (status === 'reject') {
this.model[name].message = message
break
}
} else if (typeof rule === 'function') {
rule(value, (message: string) => {
this.model[name].message = message
status = !message ? 'resolve' : 'reject'
})

if (status === 'reject') {
break
}
}
}
}
Expand Down

0 comments on commit 250ab14

Please sign in to comment.