feat(Form): add show-error prop (#5941)

This commit is contained in:
neverland
2020-03-29 15:28:35 +08:00
committed by GitHub
parent 7b2e6acd33
commit 6ce940d0db
5 changed files with 39 additions and 1 deletions
+8 -1
View File
@@ -101,6 +101,13 @@ export default createComponent({
);
},
showError() {
if (this.vanForm && this.vanForm.showError && this.validateMessage) {
return true;
}
return this.error;
},
listeners() {
const listeners = {
...this.$listeners,
@@ -540,7 +547,7 @@ export default createComponent({
scopedSlots={scopedSlots}
arrowDirection={this.arrowDirection}
class={bem({
error: this.error || this.validateMessage,
error: this.showError,
[`label-${labelAlign}`]: labelAlign,
'min-height': this.type === 'textarea' && !this.autosize,
})}