UIKit上传后更新v模型

时间:2018-09-15 21:20:42

标签: javascript vuejs2 vue-component getuikit

我正在使用UIKit的uploading-element(https://getuikit.com/docs/upload)。

好吧-我真的很想在上传完成后更新我的v模型uploading

<script>
    export default {

        data () {
            return {
                images: [],
                uploading: false
            }
        },
        mounted () {
            console.log ('Upload mounted.');

            axios
            .get ('/api/get')
            .then (response => (this.images = response.data));

            let tokenElement = document.head.querySelector ('meta[name="csrf-token"]');
            let token;

            if (tokenElement) {
                token = tokenElement.content;
            } else {
                console.error ('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
            }

            UIkit.upload ('.js-upload', {

                url: '/api/upload',
                multiple: false,

                beforeSend: function (environment) {
                },

                loadStart: function (e) {
                    this.uploading = true;
                },

                progress: function (e) {
                },

                loadEnd: function (e) {
                },

                completeAll: function () {


                           this.uploading = false;

                    axios
                    .get ('/api/get')
                    .then (response => (this.images = response.data));
                }

            });

        }
    }
</script>

不幸的是,this.uploading = true;不会更改v模型。

我在这里可以做什么?

0 个答案:

没有答案