Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!