Closed Bodekaer closed 8 years ago
This is expected behaviour in 2.0, since these changes can't be reflected in the virtualDOM and get therefore overriden during updates.
Is there a known workaround for this?
theoretically, you could do this:
beforeUpdate()
, use the DOM API to get the classes from the elementupdated()
, you could re-apply them - if the element was updated and the classes are missing.that would be pretty tedious, complicated and error-prone, though.
Eh, better to store classes in component data then & change them there. I was only asking because I was going unconventional and (in my circumstance) not using the element w/ dynamic classes in a component. Thanks for the input @LinusBorg
Vue.js version
2.0.3
Reproduction Link
http://jsfiddle.net/df4Lnuw6/18/
Steps to reproduce
See Fiddle.
What is Expected?
In Vue 1.0, it was possible to dynamically add classes. This is important for MDL support, as it dynamically adds classes like "is-upgraded".
What is actually happening?
Class names added manually are removed.