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

133
Visualizações
V-select and implementation of select-all functionality
 <v-select
        v-model="selectedRole"
        :items="roles"
        item-text="role"
        label="Select Role"
        multiple
        >
<template v-slot:prepend-item>
          <v-list-item
            ripple
            @mousedown.prevent
            @click="toggle"
          >
            <v-list-item-action>
              <v-icon :color="selectedRole.length > 0 ? 'indigo darken-4' : ''">
                {{ icon }}
              </v-icon>
            </v-list-item-action>
            <v-list-item-content>
              <v-list-item-title>
                Select All
              </v-list-item-title>
            </v-list-item-content>
          </v-list-item>
          <v-divider class="mt-2"></v-divider>
        </template>
      </v-select>

computed: {

    icon () {
      if (this.selectAllRole) return 'mdi-close-box'
      if (this.selectSomeRole) return 'mdi-minus-box'
      return 'mdi-checkbox-blank-outline'
    },
    selectAllRole () {
      console.log('this.userObj', this.userObj)
      console.log('this.roles.length', this.roles.length)

      console.log('this.selectedRole.length', this.selectedRole.length)

      return this.selectedRole.length === this.role.length
    },
    selectSomeRegion () {
      return this.selectedRole.length > 0 && !this.selectAllRole
    }
  }

methods: {
    toggle () {
      this.$nextTick(() => {
        if (this.selectAllRole) {
          this.selectedRole.roleId = []
        } else {
          this.selectedRole = this.role.slice()
        }
      })
    }'"
}

I am using v-select along with select all functionality.

When I select "Select All" it should select all the option in the drop down.

It is giving me error saying Error in render: "TypeError: Cannot read properties of undefined (reading 'length')"

Please, help me to resolve this.

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