浏览代码

normalize the componentName writing

baiyaaaaa 8 年之前
父节点
当前提交
ba983ffb96

+ 1 - 1
packages/checkbox/src/checkbox-group.vue

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

+ 2 - 2
packages/date-picker/src/picker.vue

@@ -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) {

+ 4 - 4
packages/form/src/form-item.vue

@@ -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>

+ 1 - 1
packages/form/src/form.vue

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

+ 4 - 2
packages/input/src/input.vue

@@ -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]);
       }
     }
   };

+ 1 - 1
packages/radio/src/radio-group.vue

@@ -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() {

+ 2 - 2
packages/select/src/option-group.vue

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

+ 5 - 5
packages/select/src/option.vue

@@ -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>

+ 1 - 1
packages/select/src/select-dropdown.vue

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

+ 10 - 10
packages/select/src/select.vue

@@ -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() {