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

Error - isDragReject is always true #16

Open
meirlamdan opened this issue Sep 9, 2022 · 1 comment
Open

Error - isDragReject is always true #16

meirlamdan opened this issue Sep 9, 2022 · 1 comment

Comments

@meirlamdan
Copy link

meirlamdan commented Sep 9, 2022

I defined that it is accept only pdf and it does accept only pdf files.
But even when I throw a pdf file "isDragReject" is true.
You can see it in action here and in GitHub

<script setup>
import { ref } from "vue";
import { useDropzone } from "vue3-dropzone";

import File from "./File.vue";

const props = defineProps(["accept", "files"]);
const dragDisabled = ref(false);

function onDrop(acceptFiles, rejectReasons) {
  props.files.push(...acceptFiles);
  rejectReasons.length && console.log(rejectReasons);
}
const { getRootProps, getInputProps, isDragActive, isDragReject } = useDropzone(
  {
    onDrop,
    accept: props.accept,
  }
);
const deleteFile = (file) => {
  props.files.splice(props.files.indexOf(file), 1);
};
</script>

<template>
  <div class="dropzone">
    <div
      v-bind="getRootProps()"
      class="files"
      :class="{ 'drag-active': isDragActive, 'drag-reject': isDragReject }"
    >
      <input v-bind="getInputProps()" />
      <div>
       //

      </div>
      <p v-if="isDragActive">Drop the files here ...</p>
      <p v-else>Drag 'n' drop some files here, or click to select files</p>
    </div>
  </div>
</template>

<style>
.drag-active {
  border: 2px dashed #000;
}
.drag-reject {
  border: 2px dashed #ff0000;
}
</style>
<Dropzone :files="files" accept=".pdf" />
@kakauandme
Copy link

Same happens when

multiple: false,
maxSize: 5 * 1024 * 1024,

specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants