How to do it...

We will build an icon that represents the sound volume. Adjusting the sound level will change the icon. The icon itself will be a component, like the following:

Vue.component('sound-icon', {   template: "<span>{{soundEmojis[level]}}</span>",   props: ['level'],   data () {     return {       soundEmojis: ['', '', '', '']     }   } })

Note how ...

Get Vue.js 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.