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

398
Vistas
this.template.querySelector not working salesforce LWC

I have fetched the sumValue ,sumValueColor, from a class to lwc js. and i have to set the sumValueColor to two CSS classes.i have done like the this.

js

@wire(getData, { iId: '$contactId' })
    GetData({data}){
        if (data) {
            this.sumValue= data.sumValue;
          this.template.querySelector('div.sumValueColor1').style.setProperty('--sumValueColor', data.sumValueColor);
            this.template.querySelector('div.sumValueColor2').style.setProperty('--sumValueColor', data.sumValueColor);
      
}
}

css

div.sumValueColor1 {
    color: var(--sumValueColor);
}
div.sumValueColor2 {
    color: var(--sumValueColor);
}

html

<template>
   <template if:true={hasChanges}>
    <div class="slds-grid slds-grid_align-center">
            <div class="primary-num-text-large"  >
            <div class="sumValueColor1" >{sumValue}</div>
            </div>
        </div>
  </template>
 <template if:false={hasChanges}>
    <div class="slds-grid slds-grid_align-center">
            <div class="primary-num-text-medium"  >
            <div class="sumValueColor2" >{sumValue}</div>
            </div>
        </div>
<template>

But this is not working ,the color is not reflecting.how to fix this? can someone help?

Thanks, Serah

about 4 years ago · Juan Pablo Isaza
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