-
Notifications
You must be signed in to change notification settings - Fork 546
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
v-bind support binding multiple objects #550
Comments
Currently most scripts use |
I agree, I don't think we need to add another variation to this API. |
@posva I think this is not a issue... |
@cyfung1031 using spread operator or Object.assing would result in overriding props instread of merging them. What if featAProps have onClick/class and featBProps as well? that's why you have to use mergeProps |
This is another issue. You are not asking for binding multiple objects. You are asking for binding multiple methods to the same attribute in the same component. You should open another issue for this. They are different. The working principle for |
This seems to be supported (accidentally?) only if you have other attributes bound too. // Works
<MyComponent foo="bar" v-bind="$attrs, featAProps, featBProps" />
// Doesn't
<MyComponent v-bind="$attrs, featAProps, featBProps" /> This is because attributes + v-bind is compiled directly to a _createBlock(_component_MyComponent, _mergeProps({ foo: "bar" }, _ctx.$attrs, _ctx.featAProps, _ctx.featBProps), null, 16 /* FULL_PROPS */) But _createBlock(_component_MyComponent, _normalizeProps(_guardReactiveProps(_ctx.$attrs, _ctx.featAProps, _ctx.featBProps)), null, 16 /* FULL_PROPS */) Related: vuejs/eslint-plugin-vue#1731 |
Is this still considered a bug or is it a feature? It seems to still work in Vue 3 without any errors and I only have a separate |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
What problem does this feature solve?
Currently, if we want to pass attributes from multiple sources we have to manually import
mergeProps
helper and door use computed property
It would be better if we could just do:
What does the proposed API look like?
Allow passing an array of props to v-bind
v-bind="[x,y,..]"
The text was updated successfully, but these errors were encountered: