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

Feat/mixin and or exported fns #1

Closed
wants to merge 2 commits into from

Conversation

renatodeleao
Copy link
Owner

No description provided.

There's a particular situation where directives are not the best alternative: Renderless components that exposes their internal functionality via slot scope bindings. Consumers of this componentes usually don't need to be aware of what is binded, just need to do v-bind="slotScope" to their slot component and get on with their lives.

The problem is that we can't pass a directive up via scope. A common counterpoint is "just import it on the consumer and apply to the slot-scope element". This is mostly true, but it's also equivalent to say to to mcdonals customer "here's your big mac! Don't forget to add your burger in the middle before eating, since it's served on the side". — weird right?

- So this commit export of the "public" directive methods (bind, unbind) that would allow use to programatically use v-click-outside package. A companion namespaced mixin can shortcut the directive bindingValue object format, but I understand that mixins are not that popular and vue3 will make them obsolete, so it's totally optional to remove it from this commit.
- updates "examples" with 2 boxes using this version.
@renatodeleao
Copy link
Owner Author

Same can be achieved without much of a hassle by destructuring the directive property from default export.

import vClickOutside from 'v-click-outside';
const { bind, unbind } = vClickOutside.directive

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.

1 participant