Skip to content

Re-initialize after updating containers #3

@bhulsman

Description

@bhulsman

Currently I'm settings options for vue-dragula in the ready callback of the main Vue file, like so:

var Vue = require('vue');

Vue.use(require('vue-dragula'));

new Vue({

    el: '#app',

    components: {
        'categories': require('./components/categories.vue'),
    }

    data: {
        // some data...
    },

    created: function () {

        Vue.vueDragula.options('categories', {
            // options...
        });

    }
});

But in another component, I have an update function for the categories, which requires me to re-initialize vue-dragula so new (or removed) containers are taken into account. In this case the categories are the bags/containers.

export default {

    data: function () {
        return {
            // some data...
        };
    },

    methods: {

        saveCategories: function () {

            // save categories to database
            // use this.$set('categories', response.data.categories); so update categories data of Vue instance
            // dragging doesn't anymore, re-init?

            Vue.vueDragula.options('categories', function () {
                // options again...
            });
        }
    }
}

How can I access Vue.vueDragula.options inside of a components method? this doesn't work, and I can't find anything related on Vue itself or vue-dragula.

This is probably not really an issue, but maybe the docs can be updated if you know how to do something like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions