2.5.3
https://codesandbox.io/s/vjyn5v63x5
Apply a conditional class using a class name that contains a dash.
In my case:
v-bind:class="{ navbar-shrink: scrolled }"
I would expect the normal behaviour of rendering the conditional class
The app broke with the following error message:
- invalid expression: Unexpected token - in
{ navbar-shrink: scrolled }
Raw expression: :class="{ navbar-shrink: scrolled }"
By changing the class name everything works as usual:
v-bind:class="{ navbarShrink: scrolled }"
But this behaviour could be an issue when using certain bootstrap or bulma css classes on which we don't have complete control.
It's JavaScript so you need to quote the keys.
Most helpful comment
It's JavaScript so you need to quote the keys.