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

293
Visualizações
How to color the background with event.target?

I'm working with drag-and-drop in my application, in this case I can drag users to different projects in a list.

Now i'm styling the UI and I want to colour the background of my item-list, but it doesn't really work. When I drag the item over <v-list-item-avatar> or <v-list-item-title> the background of the list-item does not change its colour. Only by dragging over <v-list-item> . So it's a little bit buggy.

I tried different approaches, but none of them were helpful. How can I optimize the approach to get the expected result?

Vue-Snippet:

<v-list-item-group v-model="selectedProjectItem">
          <v-list-item
            @drop='onDrop($event, project)'
            @dragover.prevent
            @dragenter.prevent
            @dragenter="dragenter($event)"
            @dragleave="clearDrag($event)"
            v-for="(project, index) in visibleProjects"
            :key="project.id"
            link
            @click="emitAllUsers(project, index)"
            class="projectItemSize project"
            id="projectlist"
            >
          <v-list-item-avatar  size="35" class="avatar">
            <v-img v-bind:src="returnImage(project,project.image)" />
          </v-list-item-avatar>
          <v-list-item-title class="project">
            {{ project.name }}
          </v-list-item-title>
         </v-list-item>
 </v-list-item-group> 

And this is my method:

dragenter (evt) {
      const event = evt.target
      if (event.id === 'projectlist') {
        event.style.background = '#0061ff'
        event.style.color = 'white'
      }
    }

EDIT: The left picture below shows, that the background of the list-item have not changed, when dragging the item over the title.

enter image description here

over 4 years ago · Santiago Trujillo
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