Skip to content

[Vue warn]: Injection "eventBus" not found #311

@fgmehlin

Description

@fgmehlin

Hi,

Just installed the vue-grid-layout and am having an error while trying the minimal example.
(probably a duplicate of Issue 247 but there are no solutions that I can use there).

I'm using:

  • vue v2.6.10
  • vue-grid-layout v2.3.4

Tested on: Firefox 65, Chrome 73

Error

[Vue warn]: Injection "eventBus" not found

found in

---> <GridItem>

[Vue warn]: Error in created hook: "TypeError: Cannot read property '$on' of undefined"

found in

---> <GridItem>

I have quickly tested with vue-grid-layout 2.3.2 and/or vue 2.6.9, the same is happening.

My code

 <grid-layout
               :layout.sync="layout"
               :col-num="2"
               :row-height="450"
               :is-draggable="true"
               :is-resizable="true"
               :is-mirrored="false"
               :vertical-compact="true"
               :margin="[10, 10]"
               :use-css-transforms="true"
          >
            <grid-item 
               v-for="comp in layout" 
              :x="comp.x" 
              :y="comp.y" 
              :w="comp.w" 
              :h="comp.h" 
              :i="comp.i">
          </grid-item>
</grid-layout>

Local data:

data: () => {
    return {
      layout: [
      {
        type: "WidgetComponent",
        title: "test1",
        x: 0,
        y: 0,
        h: 1,
        w: 2,
        i: "0",
      },
      {
        type: "WidgetComponent",
        title: "test2",
        x: 0,
        y: 2,
        h: 2,
        w: 1,
        i: "1",
      },
   ...
 ]
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions