Skip to Content
Vue.js 2 Cookbook
book

Vue.js 2 Cookbook

by Andrea Passaglia
April 2017
Intermediate to advanced
454 pages
12h 51m
English
Packt Publishing
Content preview from Vue.js 2 Cookbook

Kebab case and camel case

Kebab case is written like works are put in a shish-kebab--like-this-for-example. Camel case uses capitalization instead of spaces--capitalizationLooksLikeThis. Since HTML is case insensitive, it cannot use camel case. However, JavaScript is all about camel case; how do we make the two work together?

What Vue does is that it converts all the camel case into kebab case once it has to go in HTML. This is relevant to props because they are used in HTML.

Suppose, for a second, that our level variable is now called soundLevel:

props: ['soundLevel']

Consider that you try to use it as is in the HTML:

<sound-icon :soundLevel="soundLevel"></sound-icon>

It won't work because the variable is now called sound-level in the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Vue.js 2

Learning Vue.js 2

Olga Filipova
Pro Vue.js 2

Pro Vue.js 2

Adam Freeman

Publisher Resources

ISBN: 9781786468093Supplemental Content