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

Make v-model work with props #9749

Closed
backbone87 opened this issue Mar 21, 2019 · 1 comment
Closed

Make v-model work with props #9749

backbone87 opened this issue Mar 21, 2019 · 1 comment

Comments

@backbone87
Copy link

What problem does this feature solve?

It would be nice, if v-model works when using a prop as its target. By allowing this, we would reduce error prone boilerplate code, when having "pass-through" input/model components.

A similar request was made in #8403 , however there is acutally no need to introduce a new modifier or anything.

The v-model logic would be modified in the following way:

  • If the target of v-model is not a prop: Use the current behavior
  • Else, the target of v-model is a prop:
    • If the prop is the model of this component (by looking at the components options.model.prop), emit an event of the type declared in options.model.event with the new value
    • Else, emit an event of type update:PROP_NAME with the new value

Similar logic can be done for the .sync modifier targeting props.

What does the proposed API look like?

No API changes needed

@yyx990803
Copy link
Member

I don't think I understand what you are asking for. Please follow the RFC process to better describe your proposal.

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