[Vuejs]-How to have different colors for different list items in Vue.js?

0👍

You would create a method that takes your item and returns a style or class string, object or array. Then bind the return value to your style or class.

<div :style='getStyle(item)' :class='getClass(item)' />
getStyle(item) {
   // your logic returning a style object
}
getClass(item) {
   // your logic returning a string, string array, or object.
}

You can find more details here:
https://v2.vuejs.org/v2/guide/class-and-style.html

Leave a comment