Hi I got a problem with packery.
Based on this solution https://codepen.io/Monocle/pen/ZbeBGL
I have every grid-item as a component and then in app.js (main file) im initializing packery based on example given.
var pckry = new Packery(container, {
itemSelector: '.grid-item',
columnWidth: '.grid-sizer',
});
I want now to handle turn on/off components and then making them draggabilly and bind/unbind to packery. But the problem is I cant make packery as an attrbute of vue object and just make this.pckry.getShiftPositions() (based on example: https://codepen.io/desandro/pen/PZrXVv).
pckry.on( 'dragItemPositioned', function() {
// save drag positions
var positions = pckry.getShiftPositions( 'data-item-id' );
localStorage.setItem( 'dragPositions', JSON.stringify( positions ) );
});
The problem is with handling instance of packery object I guess. its just not working.
this.pckry.on( 'dragItemPositioned', function() {
// save drag positions
var positions = this.pckry.getShiftPositions( 'data-item-id' );
localStorage.setItem( 'dragPositions', JSON.stringify( positions ) );
});
Doesnt actually work. When im making it as
this.pckry = newPackery(...);
How can I actually handle that?