safrazik / vue-file-agent

The most beautiful and full featured file upload component for Vue JS
https://safrazik.github.io/vue-file-agent/
MIT License
731 stars 93 forks source link

cant re display selected image or video that stored in data or store #133

Closed alireza2281 closed 3 years ago

alireza2281 commented 3 years ago

Describe the bug I'm selecting file and store it in data of component or in store, and then navigate to other pages. when i come back to the page that file agent exists i restore the selected files to the file agent component the meta data of files would appear but the image itself wont show and when id checked the image preview tag the source is like this:

<img src="function () { [native code] }" class="file-preview-img">

To Reproduce 1.select image 2.store image data to store 3.navigate to any other pages 4.back to prev page 5.fill v-model of file agent component with data stored in store

image

the data store in store is like this:

image

Desktop (please complete the following information):

safrazik commented 3 years ago

You only need file object from the fileRecord for storage

I have setup a CodePen demo for you

    onSelect(fileRecords) {
      console.log('onSelect', fileRecords);
      const fileRecordsToStore = fileRecords.map((fileRecord) => {
        // only the file object is enough for storage
        return {
          file: fileRecord.file
        };
      });
    }