Vue 3 mobile event listeners and swipe

Viewed 677

In Vue 3, I want to trigger a function when a user swipes left / right. (I made a calendar and interested in having months changed on swiping)

I found this package: https://github.com/robinrodricks/vue3-touch-events (npm install vue3-touch-events) but it's not working and I get the following errors:

and imported the relevant packages in main.js:

import Vue from "vue";
import Vue3TouchEvents from "vue3-touch-events";

and in public/index.html:

    <script src="https://raw.githubusercontent.com/robinrodricks/vue3-touch-events/master/index.js"></script>

after that, in main.js If registered as:

createApp(App)
  .use(Vue3TouchEvents)

then I get the error: "Maximum recursive updates exceeded in component ..." And the event won't be fired.

If registered as

Vue.use(Vue3TouchEvents);

then I get the error "export 'default' (imported as 'Vue') was not found in 'vue'" And the event still won't be fired

What's wrong? How to implement it right or make a solution in another way? (@starttouch and mobile event listeners seems to not be supported in Vue 3)

1 Answers

I Think You Installed It Wrong Way

  1. npm cache clean --force
  2. npm install vue3-touch-events

Also Remove That script src line from index.html. I Hope This Will Help Your Query.

Related