Open adhamfarrag opened 2 years ago
Please provide a test case. It looks like you're not overwriting the myFiles
object just pushing and splicing so vue might not catch the update? I advice to test without using plugins first.
I had the same issue binding to files did nothing. I ended up just using the updateFiles
event and setting the parameter to a component variable. This should work for you 😀
<template>
<div>
<file-pond name="test" ref="pond" label-idle="Drop files here..." v-bind:allow-multiple="true" accepted-file-types="image/jpeg, image/png" v-on:updatefiles="updateFiles" />
</div>
</template>
<script>
// Import Vue FilePond
import vueFilePond from "vue-filepond";
// Import FilePond styles
import "filepond/dist/filepond.min.css";
// Import image preview plugin styles
import "filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css";
// Import image preview and file type validation plugins
import FilePondPluginFileValidateType from "filepond-plugin-file-validate-type";
import FilePondPluginImagePreview from "filepond-plugin-image-preview";
// Create component
const FilePond = vueFilePond(
FilePondPluginFileValidateType,
FilePondPluginImagePreview
);
export default {
name: "app",
data: function () {
return {
myFiles: []
};
},
methods: {
updateFiles(files) {
this.myFiles = files;
this.$root.$emit('updatePendingFiles', this.myFiles);
},
},
components: {
FilePond,
},
};
</script>
Your issue is very simple, you're not using events but props, so your methods will never be called (the casing is also wrong)
Instead of
:init="handleFilePondInit"
:processFile="handleFilePondProcessfile"
:removeFile="handleFilePondRemovefile"
:addfile="handleOnaddfile"
Use
@init="handleFilePondInit"
@processfile="handleFilePondProcessfile"
@removefile="handleFilePondRemovefile"
@addfile="handleOnaddfile"
Is there an existing issue for this?
Have you updated Vue FilePond, FilePond, and all plugins?
Describe the bug
myFiles object doesn't get binded after any change. I'm using V6 with Nuxt.js V2.
Reproduction
Created a component including user profile form, and added this component to it in the right fields.
Environment