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

196
Visualizações
VueJs getting error from Dynamically array passing as string but works fine if the array is hard coded

I am trying to pass the array to the Draggable Vue component. The array generating dynamically from the inside loop but getting the error Invalid prop: type check failed for prop "list". Expected Array, got String with value "arrOne" while assigning the array to :list

array rendering and assigning script:

     <draggable
      class="list-group mttr_kt-block"
     :list="'arr'+item.code"  //here output of item.code is **One** , final array will **arrOne**
     group="tasks">

     </draggable> 

The above codes throwing the exception and not working as expected but if I assign hard coded array as following its working fine:

     <draggable
      class="list-group mttr_kt-block"
     :list="arrOne"  //this hard coded **arrOne**
     group="tasks">

     </draggable>  

Note: the array arrOne already declared inside Vue scripts, no issue with declartion.

Thanks in advance for your help. Please please let me know if additional information is needed from my side.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I assume arrOne and other arrays are defined in data(). If so, you can use these:

<draggable
   class="list-group mttr_kt-block"
   :list="getArray(item.code)"
   group="tasks">
</draggable>
data() {
   return {
      arrOne: [1, 2],
      arrTwo: [3, 4],
   };
},
methods: {
   getArray(name){
      return this.$data['arr' + name];
   }
},
about 4 years ago · Juan Pablo Isaza Relatório
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