lrembacz / vue-responsive-grid-layout

Vue Repsonsive Grid Layout
MIT License
83 stars 19 forks source link

Question about latest version (v1.1.3) and Vue.warn about eventBus. #15

Closed shulard closed 5 years ago

shulard commented 5 years ago

Hello,

We are using your lib inside a project (v1.0.2) and we tried to install the latest version (v1.1.3) today. We get a strange error that I don't understand :

[Vue warn]: Injection "eventBus" not found

After the update, I can't move any block on the page, I think it's related but I've no clue on where to get started...

Have you already encountered such issue ?

lrembacz commented 5 years ago

Its about this line i guess: https://github.com/lrembacz/vue-responsive-grid-layout/blob/master/src/components/VueGridItem.vue#L85.

Can you please give me some code of your Layout? Is VueGridItem wrapped into VueGridLayout component actually?

shulard commented 5 years ago

Hello !

Yes we wrapped VueGridItem inside a VueGridLayout component.

Here is my layout's code :

<vue-responsive-grid-layout
    :layouts="layouts"
    :cols="12"
    :rowHeight="65"
    :breakpoints="breakpoints"
    :colsAll="columns"
    @layout-update="onLayoutUpdate"
    @layout-init="setHeight"
>
    <template slot-scope="props">
        <vue-grid-item
            v-for="item in props.layout"
            v-if="item.i && props"
            :key="item.i"
            :x="item.x"
            :y="item.y"
            :w="item.w"
            :h="item.h"
            :i="item.i"
            :cols="props.cols"
            :container-width="props.containerWidth"
            :rowHeight="50"
            :margin="[30,30]"
            handle=".drag"
            ref="gridItem"
        >
            <component
                v-bind:is="getComponentById(item.i).name"
                v-bind="transformDefinition(getComponentById(item.i))"
                v-bind:draggable="true"
                v-on="getComponentById(item.i).events"
            ></component>
        </vue-grid-item>
    </template>
</vue-responsive-grid-layout>
lrembacz commented 5 years ago

I'm not sure why you are getting this error actually. I did not get this kind of error in my tries. Just check this sandbox code and try to manage your layout to be similar and maybe it's gonna work. https://codesandbox.io/s/jzlzv24w53

Or if you're gonna get this error more, just give me some example of code on github or on sandbox. Thanks!

lrembacz commented 5 years ago

@shulard Check if the new version has the same issue please.

shulard commented 5 years ago

@lrembacz I've just installed the new 1.1.5 version. The problem is still present.

[Vue warn]: Injection "eventBus" not found

found in

---> <VueGridItem>
       <Dashboard> at src/components/generics/Dashboard.vue
         <Dashboard> at src/views/Dashboard.vue
           <App> at src/App.vue
             <Root>

I also see different errors, maybe it'll help...

[Vue warn]: $attrs is readonly.

found in

---> <VueResponsiveGridLayout>
       <Dashboard> at src/components/generics/Dashboard.vue
         <Dashboard> at src/views/Dashboard.vue
           <App> at src/App.vue
             <Root> vue.esm.js:628
[Vue warn]: $listeners is readonly.

found in

---> <VueResponsiveGridLayout>
       <Dashboard> at src/components/generics/Dashboard.vue
         <Dashboard> at src/views/Dashboard.vue
           <App> at src/App.vue
             <Root> vue.esm.js:628

Maybe it's related to our use case, I'll try to dig a bit inside our implementation to be sure everything is fine. I'll also try to build a basic layout outside of our components to validate the package usage.

Thanks, for your help, I'll update this issue with my findings.

shulard commented 5 years ago

Hello,

We found that the issue is related with the vue-cli configuration in our project. There was some incompatibilities with the babel-core@7.0.0 package and the configuration...

We tried to reconfigure the project after updating all the dependencies and everything is fine now regarding your lib... Sorry, this is a weird bug from our side.

I close that issue which is not relevant anymore...

mjmicro commented 5 years ago

HI @shulard I am Facing the same issue can you please tell me, how can i resolve this.