normalize the componentName writing

pull/1380/head
baiyaaaaa 2016-11-26 15:18:38 +08:00 committed by cinwell.li
parent 66b055f9d2
commit ba983ffb96
10 changed files with 31 additions and 29 deletions

View File

@ -15,7 +15,7 @@
watch: {
value(value) {
this.$emit('change', value);
this.dispatch('form-item', 'el.form.change', [value]);
this.dispatch('ElFormItem', 'el.form.change', [value]);
this.broadcast('ElCheckbox', 'initData', [value]);
}
},

View File

@ -236,7 +236,7 @@ export default {
if (!val && this.picker && typeof this.picker.handleClear === 'function') {
this.picker.handleClear();
}
this.dispatch('form-item', 'el.form.change');
this.dispatch('ElFormItem', 'el.form.change');
},
value: {
immediate: true,
@ -358,7 +358,7 @@ export default {
handleBlur() {
this.$emit('blur', this);
this.dispatch('form-item', 'el.form.blur');
this.dispatch('ElFormItem', 'el.form.blur');
},
handleKeydown(event) {

View File

@ -47,7 +47,7 @@
export default {
name: 'ElFormItem',
componentName: 'form-item',
componentName: 'ElFormItem',
mixins: [emitter],
@ -88,7 +88,7 @@
},
form() {
var parent = this.$parent;
while (parent.$options.componentName !== 'form') {
while (parent.$options.componentName !== 'ElForm') {
parent = parent.$parent;
}
return parent;
@ -192,7 +192,7 @@
},
mounted() {
if (this.prop) {
this.dispatch('form', 'el.form.addField', [this]);
this.dispatch('ElForm', 'el.form.addField', [this]);
Object.defineProperty(this, 'initialValue', {
value: this.fieldValue
@ -213,7 +213,7 @@
}
},
beforeDestroy() {
this.dispatch('form', 'el.form.removeField', [this]);
this.dispatch('ElForm', 'el.form.removeField', [this]);
}
};
</script>

View File

@ -10,7 +10,7 @@
export default {
name: 'ElForm',
componentName: 'form',
componentName: 'ElForm',
props: {
model: Object,

View File

@ -68,6 +68,8 @@
export default {
name: 'ElInput',
componentName: 'ElInput',
mixins: [emitter],
props: {
@ -105,7 +107,7 @@
methods: {
handleBlur(event) {
this.$emit('blur', event);
this.dispatch('form-item', 'el.form.blur', [this.currentValue]);
this.dispatch('ElFormItem', 'el.form.blur', [this.currentValue]);
},
inputSelect() {
this.$refs.input.select();
@ -162,7 +164,7 @@
});
this.$emit('input', val);
this.$emit('change', val);
this.dispatch('form-item', 'el.form.change', [val]);
this.dispatch('ElFormItem', 'el.form.change', [val]);
}
}
};

View File

@ -16,7 +16,7 @@
value(value) {
this.$emit('change', value);
this.broadcast('ElRadio', 'initData', value);
this.dispatch('form-item', 'el.form.change', [this.value]);
this.dispatch('ElFormItem', 'el.form.change', [this.value]);
}
},
mounted() {

View File

@ -27,13 +27,13 @@
watch: {
disabled(val) {
this.broadcast('option', 'handleGroupDisabled', val);
this.broadcast('ElOption', 'handleGroupDisabled', val);
}
},
mounted() {
if (this.disabled) {
this.broadcast('option', 'handleGroupDisabled', this.disabled);
this.broadcast('ElOption', 'handleGroupDisabled', this.disabled);
}
}
};

View File

@ -19,7 +19,7 @@
name: 'el-option',
componentName: 'option',
componentName: 'ElOption',
props: {
value: {
@ -78,7 +78,7 @@
watch: {
currentSelected(val) {
if (val === true) {
this.dispatch('select', 'addOptionToValue', this);
this.dispatch('ElSelect', 'addOptionToValue', this);
}
}
},
@ -96,7 +96,7 @@
selectOptionClick() {
if (this.disabled !== true && this.groupDisabled !== true) {
this.dispatch('select', 'handleOptionClick', this);
this.dispatch('ElSelect', 'handleOptionClick', this);
}
},
@ -123,7 +123,7 @@
this.index = this.parent.options.indexOf(this);
if (this.currentSelected === true) {
this.dispatch('select', 'addOptionToValue', [this, true]);
this.dispatch('ElSelect', 'addOptionToValue', [this, true]);
}
this.$on('queryChange', this.queryChange);
@ -132,7 +132,7 @@
},
beforeDestroy() {
this.dispatch('select', 'onOptionDestroy', this);
this.dispatch('ElSelect', 'onOptionDestroy', this);
}
};
</script>

View File

@ -13,7 +13,7 @@
export default {
name: 'el-select-dropdown',
componentName: 'select-dropdown',
componentName: 'ElSelectDropdown',
mixins: [Popper],

View File

@ -82,7 +82,7 @@
name: 'ElSelect',
componentName: 'select',
componentName: 'ElSelect',
computed: {
iconClass() {
@ -242,7 +242,7 @@
this.$emit('input', result);
this.$emit('change', result);
this.dispatch('form-item', 'el.form.change', val);
this.dispatch('ElFormItem', 'el.form.change', val);
if (this.filterable) {
this.query = '';
this.hoverIndex = -1;
@ -262,7 +262,7 @@
query(val) {
this.$nextTick(() => {
this.broadcast('select-dropdown', 'updatePopper');
this.broadcast('ElSelectDropdown', 'updatePopper');
});
if (this.multiple && this.filterable) {
this.resetInputHeight();
@ -271,12 +271,12 @@
this.hoverIndex = -1;
this.remoteMethod(val);
this.voidRemoteQuery = val === '';
this.broadcast('option', 'resetIndex');
this.broadcast('ElOption', 'resetIndex');
} else if (typeof this.filterMethod === 'function') {
this.filterMethod(val);
} else {
this.filteredOptionsCount = this.optionsCount;
this.broadcast('option', 'queryChange', val);
this.broadcast('ElOption', 'queryChange', val);
}
},
@ -286,7 +286,7 @@
if (this.$el.querySelector('.el-input__icon')) {
removeClass(this.$el.querySelector('.el-input__icon'), 'is-reverse');
}
this.broadcast('select-dropdown', 'destroyPopper');
this.broadcast('ElSelectDropdown', 'destroyPopper');
if (this.$refs.input) {
this.$refs.input.blur();
}
@ -304,13 +304,13 @@
if (icon && !hasClass(icon, 'el-icon-circle-close')) {
addClass(this.$el.querySelector('.el-input__icon'), 'is-reverse');
}
this.broadcast('select-dropdown', 'updatePopper');
this.broadcast('ElSelectDropdown', 'updatePopper');
if (this.filterable) {
this.query = this.selectedLabel;
if (this.multiple) {
this.$refs.input.focus();
} else {
this.broadcast('input', 'inputSelect');
this.broadcast('ElInput', 'inputSelect');
}
}
if (!this.dropdownUl) {
@ -398,7 +398,7 @@
let inputChildNodes = this.$refs.reference.$el.childNodes;
let input = [].filter.call(inputChildNodes, item => item.tagName === 'INPUT')[0];
input.style.height = Math.max(this.$refs.tags.clientHeight + 6, this.size === 'small' ? 28 : 36) + 'px';
this.broadcast('select-dropdown', 'updatePopper');
this.broadcast('ElSelectDropdown', 'updatePopper');
});
},
@ -525,7 +525,7 @@
if (index > -1) {
this.options.splice(index, 1);
}
this.broadcast('option', 'resetIndex');
this.broadcast('ElOption', 'resetIndex');
},
resetInputWidth() {