vuejs + vue2dropzone призыв к успеху - PullRequest
0 голосов
/ 06 мая 2018

Я совсем новичок в vuejs, поэтому не могу понять, что я делаю не так. Это моя часть скрипта для компонента vue:

<script>
    export default {
        name: 'product-main-info',
        components: {
            vueDropzone: vue2Dropzone
        },
        props: {
            propId: String,
        },
        data() {
            return {
                images: {},
                dropzoneOptions: {
                    url: '/uploadImg',
                    thumbnailWidth: 150,
                    maxFilesize: 2.0,
                    addRemoveLinks: true,
                    acceptedFiles: ".png,.jpg,.gif,.bmp,.jpeg",
                    headers: { "X-CSRF-Token": document.head.querySelector('meta[name="csrf-token"]').content },
                    params: { id: this.propId },
                    init: function() {
                        var self = this;
                        self.on("success", function (file) {
                            this.$http.get('/getProductImages/' + this.propId)
                            .then(function(response) {
                                this.images = response.data;
                            });
                        });
                    }
                }
            }
        },
        methods: {

        },
        created() {
            this.$http.get('/getProductImages/' + this.propId)
            .then(function(response) {
                console.log(response.data);
                this.images = response.data;
            });
        }
    }
</script>

Я пытаюсь получить новые обновленные данные после успешной загрузки изображения, но все, что я получаю, это:

app.js:16014 Uncaught TypeError: Cannot read property 'get' of undefined

Все, что мне нужно, это обновить мои данные, но я не могу понять, как сделать это правильно. Помогите, если возможно

...