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

Directive for both v-bind and v-on #10052

Closed
iogrt opened this issue May 20, 2019 · 1 comment
Closed

Directive for both v-bind and v-on #10052

iogrt opened this issue May 20, 2019 · 1 comment

Comments

@iogrt
Copy link

iogrt commented May 20, 2019

What problem does this feature solve?

I have several cases of components with different views, the children of these components are almost the same, but have some key differences, I want my code to be DRY and give the implementation in a base Component

Imagine i have a component with this template:

<template>
  <component is="myView" :textOptions="textOptions" />
</template>

Whatever view is chosen, there's always a text component inside that uses these textOptions like so:

<TextComponent v-bind="textOptions.props" v-on="textOptions.listeners" :otherProps=" 'other' " />

What does the proposed API look like?

I propose a new directive (which I'm calling v-all for now)

 <TextComponent v-all="textOptions" />
@posva
Copy link
Member

posva commented May 20, 2019

You already commented on the issue that was closed #9958

You may be interested in vuejs/rfcs#26 for v3
For v2, this doesn't happen often enough to introduce a new template syntax and can already be solved in a slightly more verbose way

@posva posva closed this as completed May 20, 2019
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

No branches or pull requests

2 participants