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

139
Views
how to split files from multiple v-file-input

I'm trying to upload several files in one v-file input, but then have them stored each in v-file-input. But they stay as uploaded - in one v-file-input all.

part of my component-

<v-file-input
    dense
    single-line
    multiple
    :value="file"
    @change="$emit('changeFile', $event)"
/>

changeFile handler

changeFile(obj, index, value) {
      if (!Array.isArray(value)) {
        obj[index].file = value;
      } else {
        let i = index,
          newArr = [];
        if (index < obj.length && obj.length != 1) {
          newArr = obj.slice(index + 1, obj.length + 1);
          obj.splice(index + 1);
        }
        value.forEach((it) => {
          if (i + 1 == obj.length) {
            obj[i].file = it;
          } else {
            obj.push({
              file: it,
              selectedItem: "install-workflow",
              Hash: new Date().getTime(),
            });
          }
          i++;
        });
        if (newArr.length > 0) {
          obj = [...newArr];
        }
      }
      this.WMSdef = obj;
    },

the idea of file handling is that user can add several files to any place in the array and we must shift elements in it not to lose them.

component is used like this

    <vue-file-and-box
      v-for="(item, index) in WMSdef"
      :key="item.Hash"
      :items="Phases"
      :text="item.file"
      :value="item.selectedItem"
      @change="changePhase(WMSdef, index, ...arguments)"
      @changeFile="changeFile(WMSdef, index, ...arguments)"
      @clickAdd="addFile(WMSdef)"
      @clickDelete="deleteFile(WMSdef, 'WMS', item)"
    />

and in vue dev tools I see that WMSdef as an array is stored correct - it's an array of n files and so it should be shown with v-for as an array of my components. but I get one vue-file-and-box with n files and n-1 empty vue-file-and-box components this is how it looks

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