mirror of
https://github.com/ElemeFE/element.git
synced 2025-12-19 12:04:02 +08:00
replace classList with wind-dom
This commit is contained in:
committed by
cinwell.li
parent
fd989dbd0f
commit
389d2bb7d8
@@ -35,6 +35,7 @@
|
||||
|
||||
import Popup from 'vue-popup';
|
||||
import ElInput from 'packages/input/index.js';
|
||||
import { addClass, removeClass } from 'wind-dom/src/class';
|
||||
|
||||
export default {
|
||||
mixins: [ Popup ],
|
||||
@@ -113,7 +114,7 @@
|
||||
var inputPattern = this.inputPattern;
|
||||
if (inputPattern && !inputPattern.test(this.inputValue || '')) {
|
||||
this.editorErrorMessage = this.inputErrorMessage || '输入的数据不合法!';
|
||||
this.$refs.input.$el.querySelector('input').classList.add('invalid');
|
||||
addClass(this.$refs.input.$el.querySelector('input'), 'invalid');
|
||||
return false;
|
||||
}
|
||||
var inputValidator = this.inputValidator;
|
||||
@@ -121,7 +122,7 @@
|
||||
var validateResult = inputValidator(this.inputValue);
|
||||
if (validateResult === false) {
|
||||
this.editorErrorMessage = this.inputErrorMessage || '输入的数据不合法!';
|
||||
this.$refs.input.$el.querySelector('input').classList.add('invalid');
|
||||
addClass(this.$refs.input.$el.querySelector('input'), 'invalid');
|
||||
return false;
|
||||
}
|
||||
if (typeof validateResult === 'string') {
|
||||
@@ -131,7 +132,7 @@
|
||||
}
|
||||
}
|
||||
this.editorErrorMessage = '';
|
||||
this.$refs.input.$el.querySelector('input').classList.remove('invalid');
|
||||
removeClass(this.$refs.input.$el.querySelector('input'), 'invalid');
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user