robinrodricks / vue3-touch-events

Simple touch events support for vue.js 3
MIT License
216 stars 27 forks source link

Help in Nuxt 3, where should I start? #20

Open nontakran123 opened 1 year ago

nontakran123 commented 1 year ago

Hi. I am trying to import this plugin into my Nuxt 3 project which is typescript. I have tried following the guide. which it cannot run Is there a detailed usage guideline or not? Thank you.

wellykake commented 1 year ago

@nontakran123 I added the following to a file in plugins directory

import Vue3TouchEvents from 'vue3-touch-events';

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(Vue3TouchEvents)
});

and the following to my component

 <div
            v-touch:swipe.left="()=>swipe('next')"
            v-touch:swipe.right="() =>swipe('prev')"
        >

and it's working ok.