Topic: touch event and click

lyahim free asked 4 years ago


Dear Support team,

Please give some help to make a feature to works. I have a button what has a simple click event both mobile and desktop mode. And I would like to add longPress function on mobile.

When I put the touch directive to button, on mobile the simple click event doesn't work. I tried to find a 'simple touch' event, but looks like it isn't exists. Please help me if, there are a way to make work both click and longPress on mobile.

<mdb-btn
    v-mdb-touch:longTap="longPress"
    @click="performClick"
  >

Thank you, Mihaly


Mikołaj Smoleński staff answered 4 years ago


To make click and touch events work please use the following code:

<mdb-btn
    v-mdb-touch:longTap="longPress"
    @click.native="performClick"
    @touchstart.native="performClick"
  >

Best regards


Mikołaj Smoleński staff answered 4 years ago


To make click event work in custom component You have to add native modifier. Here's an example:

<mdb-btn
    v-mdb-touch:longTap="longPress"
    @click.native="performClick"
  >

Best regards


lyahim free commented 4 years ago

Dear Mikolaj,

I tried your your suggestion, but it doeans't work with native modifier.

Thank you, Mihaly



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Vue
  • MDB Version: 6.7.1
  • Device: All
  • Browser: All
  • OS: All
  • Provided sample code: No
  • Provided link: No
Tags