Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

151
Visualizações
Vue Videojs-markers customize markers background color without creating special class for each one

I’m using videojs-marker plugin to build a customized player that loads custom markers.

Each marker has a "type" that determines its color. I know that I can give a "class" attribute to each marker but the problem is that I have a lot of types and I do not want to create a separate CSS class for each type because it will be hard to maintain.

The code for creating the markers look something like this:

const markers = this.chapters.map(chapter => ({
  time: chapter.time / 1000,
  markersType: chapter.type,
  text: chapter.label,
  class: 'cue-style'
}));

cue-style CSS class looks like this:

/deep/ .cue-style {
  background-color: blue;
}

what I want is to alter the CSS class each time with a background-color based on chapter.label

is there any way to alter the default class of the marker instead of passing a new class each time?

something like:

const markers = this.chapters.map(chapter => ({
  time: chapter.time / 1000,
  markersType: chapter.type,
  text: chapter.label,
  markerStyle: {
    'background-color': 'red'
  },
}));
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda