replace classList with wind-dom

This commit is contained in:
Leopoldthecoder
2016-10-11 16:39:54 +08:00
committed by cinwell.li
parent fd989dbd0f
commit 389d2bb7d8
10 changed files with 30 additions and 17 deletions

View File

@@ -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;
}
},