0

I just installed the masonry-layout by npm but I'm not able to load it in my component.

import  "masonry-layout";

  export default {
    name: "playerSkillComponent",

    props: ['player'],

    mounted: function () {

        // initialization of masonry

        var grid = document.querySelector('.masonry-grid');
        var msnry = new Masonry( grid, {
            // options...
            columnWidth: '.masonry-grid-sizer',
            itemSelector: '.masonry-grid-item',
            percentPosition: true
        });
     }
 }

this is the error I got:

[Vue warn]: Error in mounted hook: "ReferenceError: Masonry is not defined"

Uncoke
  • 1,832
  • 4
  • 26
  • 58

1 Answers1

1

Just update the first line (there was a type):

import Masonry from "masonry-layout";
Uncoke
  • 1,832
  • 4
  • 26
  • 58