-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
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
Overwriting "style" attribute [Vue 2.0] #3997
Comments
If you define a static attribute, Vue will not attempt to dynamically merge it. If you provide a binding, Vue will do that: |
Ok, nice to know. But Vue 1 did merge regardless of static or dynamic attribute. It would be nice if this behavior can be continued with Vue 2 as this is quite important when writing libraries/frameworks with Vue 2. I can elaborate if needed. Just my thoughts. Thanks for the answer! |
Yeah we will look into that, sure! |
Like class module, I think style should also have the same behavior for consistency. I'll try to make a PR. |
@defcc yeah, probably need to treat |
OK, I'll take a look :) |
Almost done. I'll make a PR later. |
Will this change merge styles in this case? <text-element style="color: red;"/> text-element.vue <script>
export default {
render(createElement) {
return createElement('input', {
attrs: {
type: 'text',
style: 'text-align: right;'
}
});
}
};
</script> |
Hello,
With Vue 1 "style" attribute is "merged", but with Vue 2 it is completely overwritten. Is this by design?
In the following jsfiddle, if you remove "style" attribute it will then apply "style" from within component definition. As long as "style" is present on "" (from main HTML window), it will completely overwrite component's style:
https://jsfiddle.net/rstoenescu/t0kb6vyu/2/
Thanks!
The text was updated successfully, but these errors were encountered: