0

I am using vue-grid-layout package -https://jbaysolutions.github.io/vue-grid-layout/guide/#npm and trying to add a click event for grid items. But, it seems like it is not working. How can I implement the click event for grid items?

<grid-layout
    ref="gridlayout"
    style="height:1000px"
    :layout.sync="layout"
    :col-num="12"
    :row-height="30"
    :is-draggable="true"
    :is-resizable="true"
    :responsive="true"
    :vertical-compact="true"
    :use-css-transforms="true"
    :preventCollision="true"
    :verticalCompact="false"
  >
    <grid-item
      :key="item.i"
      v-for="item in layout"
      :x="item.x"
      :y="item.y"
      :w="item.w"
      :h="item.h"
      :i="item.i"
      @click="widgetClicked(item)"
    >
      <GridComponent :grid_item="item" />
      <span class="content"></span>
    </grid-item>
  </grid-layout>

1 Answer 1

2

Basically the grid items in vue-grid-layout do not support @click or @mousedown events. And according to a contributor, you have to implement it yourself by adding a div. I am linking the github issue for your reference.

Github Issue for the same.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! It worked by calling a click event on v-container

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.