VueJS и Plupload - PullRequest
       39

VueJS и Plupload

1 голос
/ 16 января 2020

Здравствуйте, я новичок в vuejs, и я хотел бы знать, как использовать plupload в vuejs. Пример будет приветствоваться.

Я импортировал плагин в скрипт компонента и настроил как в https://www.plupload.com/examples/, и я попытался сделать console.log, чтобы сначала проверить, хорошо ли изображение загружен, но ничего

Вот что я попробовал:

<template>
    <div id="uploader">
        <p>Your browser doesn't have Flash, Silverlight or HTML5 support.</p>
    </div>
</template>

<script>
    import $ from 'jquery';
    import { plupload } from '../../public/plugins/plupload/js/plupload.dev'

    export default {
        methods:{
            load() {
                var uploader = plupload.Uploader({
                    runtimes: 'silverlight',
                    browse_button: 'uploader_browse',
                    silverlight_xap_url: '../../public/plugins/plupload/js/Moxie.xap',

                    filters: {
                        max_file_size: '10mb',
                        mime_types: [
                            {title: "Image files", extensions: "jpg,gif,png"},
                            {title: "Zip files", extensions: "zip"}
                        ]
                    },

                    init: {
                        PostInit: function () {

                            document.getElementsByClassName('plupload_start').onclick = function () {
                                uploader.start();
                                return false;
                            };
                        },

                        FilesAdded: function (up, files) {
                            plupload.each(files, function (file) {
                                /* eslint-disable no-console */
                                console.log("Files", file)
                            });
                        },

                        UploadProgress: function (up, file) {
                            /* eslint no-console: "error" */
                            console.log("Percent", file.percent);
                        },

                        Error: function (up, err) {
                            /* eslint no-console: "error" */
                            console.log("Error #" + err.code + ": " + err.message);
                        }
                    }
                });

                uploader.init();
            }
        },

        mounted() {
            this.load();
        }
    }
</script>

Нужна помощь, пожалуйста

...