[Vuejs]-How to use dropzone with vuejs with out cli

0๐Ÿ‘

โœ…


const app = new Vue({
el: '#newpost',
data: {
form: {
title:'',
},
allerros: [],
success : false,
},
methods : {
onSubmit(){

        },
        DzSpanclick(){
            $("#filedrag").click();
        },
        DZint() {
            let dz = document.querySelector("#filedrag");
            var previewNode = document.querySelector("#dz-template");
            previewNode.id = "";
            var previewTemplate = previewNode.parentNode.innerHTML;previewNode.parentNode.removeChild(previewNode);
            Dropzone.autoDiscover = false;
            this.uploadImageGalleryVar = new Dropzone(dz, {
                url:"{$base_dir}post",
                parallelUploads: 100,
                paramName: "file",
                params: { do: "imageupload" },
                thumbnailWidth: 600,
                thumbnailHeight: 600,
                autoProcessQueue: false,
                acceptedFiles:"image/*",
                previewTemplate: previewTemplate,
                uploadMultiple: false,
                maxFiles: 8,
                maxFilesize: 5,
                autoDiscover : false,
                previewsContainer: "#previews",
                headers: { "Accept": "application/javascript" }
            });
        },

    },
    mounted: function() {
        this.DZint();
    }

});

Leave a comment