Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add $listeners to component #39

Closed
wants to merge 1 commit into from

Conversation

c01nd01r
Copy link

Hi!
I added $listeners to TheMask component for simple handling events with dynamic components.
At the moment, when using dynamic components, it is possible to handle events of only one type -event for native input or event.native for TheMask component.
After added $listeners, its example may be possible:

<template>
  <div class="ui-input">
    <component 
      type="text"
      :is="dynamicInput"
      v-bind="{ mask }"
      @focus="hasFocus = true"  <!-- works with native input and TheMask comp. -->
    >
  <div/>
</template>

<script>
import { TheMask } from 'vue-the-mask';

export default {
  name: 'ui-input',
  data() {
    return {
      hasFocus: false,
    };
  },
  props: {
    mask: {
      type: [Array, String],
      default() {
        return null;
      },
    },
  },
  computed: {
    dynamicInput() {
      return (this.mask) ? 'TheMask' : 'input';
    },
  },
  components: {
    TheMask,
  },
}
</script>

@c01nd01r
Copy link
Author

@neves Also, please look at this PR: #34. This solves a similar problem.

@c01nd01r
Copy link
Author

It's incorrect work with @input handler in parent.

@c01nd01r c01nd01r closed this Oct 28, 2017
@c01nd01r c01nd01r deleted the $listeners branch October 28, 2017 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant