JillzTom's avatar

v-bind:class has problem with hyphenated class names

If I use

v-bind:class="{ img-holder-selected : isUpload}"

I'm getting the following warning:

[Vue warn]: Invalid expression. Generated function body:  {scope.img-scope.holder:scope.isUpload}

and the error message: Uncaught TypeError: Cannot read property 'get' of undefined.

But If I use

v-bind:class="{ imgHolderSelected : isUpload}"

it's working well. Does that mean I cannot use hyphenated classes in vue?

0 likes
3 replies
microcipcip's avatar

This is not a Vue.JS issue. In javascript you can't have a object property with hyphens, unless you use the thomaskim example.

Please or to participate in this conversation.