Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

314
Vistas
How to have different colors for different list items in Vue.js?

I'm trying to do a task list using javascript (vue.js and node.js) where the elements of the list have different colors based on their properties. For example, if an item in the list has a property date that is less than three days away from the current date to have a red background color and items of the list that have dates that are more than three days away from the current date to have green background color. Is this possible to achieve this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

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://vuejs.org/v2/guide/class-and-style.html

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda