Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] in browser Chrome, filepond not display image preview immediatly when set files #253

Open
2 tasks done
scil opened this issue Jun 6, 2022 · 2 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@scil
Copy link

scil commented Jun 6, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Have you updated Vue FilePond, FilePond, and all plugins?

  • I have updated FilePond and its plugins

Describe the bug

apply files to filepond , the image preview not appear until clicking vue components in Vue Devtools.

this issue only found in browser chrome, not firefox.

in normal situation, the related html code (.filepond--image-preview-wrapper > div.filepond--image-preview > div > div > div) is like

<div class="filepond--image-bitmap" style="transform: scale3d(1, 1, 1);">
   <canvas width="736" height="460"></canvas>
</div>

but when the preview not display, the html code is

<div class="filepond--image-bitmap" style="transform: scale3d(1, 1, 1);">
</div>

there is no canvas until I open vue devtools and click inside.

Reproduction

file-uploader.vue

<template>
    <file-pond
      name="test"
      ref="pond"
      accepted-file-types="image/*"

      :label-idle="labelIdle"
      :files="setFiles"
    />
</template>

<script>
// Import Vue FilePond
import vueFilePond, { setOptions } 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 FilePondPluginFileMetadata from "filepond-plugin-file-metadata"
import FilePondPluginFileValidateType from "filepond-plugin-file-validate-type";
import FilePondPluginImagePreview from "filepond-plugin-image-preview";
import FilePondPluginImageValidateSize from "filepond-plugin-image-validate-size";
import FilePondPluginImageCrop from "filepond-plugin-image-crop";


// Create component
const FilePond = vueFilePond(
    FilePondPluginFileMetadata,
    FilePondPluginFileValidateType,
    FilePondPluginImagePreview,
    FilePondPluginImageValidateSize,
    FilePondPluginImageCrop
);


export default {
  name: "file-uploader",
  components: {
    FilePond,
  },
  props: {
    labelIdle:  {type:String,},
    setFiles: {type: Array, default: function(){return [];}},
  },
  data: function () {
    return {
    };
  },

};
</script>

use this vue components in a c# Razor file

<file-uploader :use-oc-media-upload="useOCMediaUpload" v-model="currentFileObjects" :set-files="setFiles" :delete-url="deleteUrl" :label-idle="labelIdle" :upload-url="uploadUrl"/>

<script>
window.appHalfForm = new Vue({

  data: {
            labelIdle:' set img',
            setFiles:[
                {
                    source:"@Html.Raw(Model.CoverImg)",
                    options: {type:'local',},
                },
            ],

},

});
</script>

temp cure

Now to make the picture preview show, I use appHalfForm.$data.labelIdle +=' '.
I tried appHalfForm.$forceUpdate() but not worked.

  mounted:function () {
    this.updateCoverImgPeview()
  },
  methods:{

     updateCoverImgPeview: function(){
         var me = this;
         setTimeout(function(){
            me.labelIdle +=  ' ';
         }, 500)
     },
},

I use a file explorer and also call this updateCoverImgPevie when selecting a img for cover img. the setTimeout is necessary for my file explorer.

Environment

- Device: PC
- OS: windows 10
- Broser: chrome 103
- Vue version: Vue 2.6.14
@scil scil added the bug Something isn't working label Jun 6, 2022
@FrankCJC
Copy link

Can you even make code in browser section work?

@scil
Copy link
Author

scil commented Jan 13, 2023

thank you. but do you mean by " code in browser section"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants