Skip to content

Commit

Permalink
fix(components): remove duplicate event handlers (#462)
Browse files Browse the repository at this point in the history
fixes #453
  • Loading branch information
devCrossNet committed Sep 21, 2019
1 parent 477a207 commit 0abd6e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 31 deletions.
17 changes: 6 additions & 11 deletions src/app/shared/components/VueInput/VueInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
:class="[value ? $style.hasValue : '']"
:autofocus="autofocus"
v-bind="$attrs"
v-on="handlers"
v-on="{
...this.$listeners,
input: (e) => {
$emit('input', e.target.value);
},
}"
ref="input"
/>
<span :class="$style.bar"></span>
Expand Down Expand Up @@ -99,16 +104,6 @@ export default {
return classes;
},
handlers() {
delete this.$listeners.input;
return {
...this.$listeners,
input: (e: any) => {
this.$emit('input', e.target.value);
},
};
},
},
data(): any {
return {
Expand Down
13 changes: 4 additions & 9 deletions src/app/shared/components/VueSelect/VueSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
:disabled="disabled"
:autocomplete="autocomplete"
v-bind="$attrs"
v-on="handlers"
v-on="{
...this.$listeners,
input: onInput,
}"
>
<option v-for="(option, idx) in selectOptions" :key="idx" :value="option.value" :selected="isSelected(option)">
{{ option.label }}
Expand Down Expand Up @@ -109,14 +112,6 @@ export default {
currentValueAsArray(): string[] {
return this.value.split('|');
},
handlers() {
delete this.$listeners.input;
return {
...this.$listeners,
input: this.onInput,
};
},
},
methods: {
isSelected(option: IVueSelectOption): boolean {
Expand Down
17 changes: 6 additions & 11 deletions src/app/shared/components/VueTextarea/VueTextarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
:class="[value ? $style.hasValue : '']"
:autofocus="autofocus"
v-bind="$attrs"
v-on="handlers"
v-on="{
...this.$listeners,
input: (e) => {
$emit('input', e.target.value);
},
}"
ref="input"
></textarea>
<span :class="$style.bar"></span> <label :for="name"> {{ placeholder }}<sup v-if="required">*</sup> </label>
Expand Down Expand Up @@ -88,16 +93,6 @@ export default {
return classes;
},
handlers() {
delete this.$listeners.input;
return {
...this.$listeners,
input: (e: any) => {
this.$emit('input', e.target.value);
},
};
},
},
data(): any {
return {
Expand Down

0 comments on commit 0abd6e5

Please sign in to comment.