[Vuejs]-How to style child component with passed values?

3👍

The best way would be to create a style computed in the child element:

props: ['active'],
computed: {
    styles(){
      return { 
        //note the camelCase instead of '-' 
        'fontFamily': this.active[0][2],
         .....
      }
    }
}

and then in the template:

<div :style="styles"></div>
👤Tomer

Leave a comment