Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touch events not bound #1

Closed
gilphilbert opened this issue May 3, 2021 · 2 comments
Closed

Touch events not bound #1

gilphilbert opened this issue May 3, 2021 · 2 comments

Comments

@gilphilbert
Copy link

gilphilbert commented May 3, 2021

Thanks for creating this library - exactly what I was looking for! However, I can't get it working!

I installed using npm (npm -i -S vue3-touch-events)

In my main JS file, I have the following:

import Vue from 'vue'
import VueRouter from 'vue-router'
import Vue3TouchEvents from 'vue3-touch-events'
...
Vue.use(Vue3TouchEvents)

Vue.use(VueRouter)
...
  new Vue({
    router,
    render: h => h(App)
  }).$mount('#app')

Then, in my template I have the following defined:

<template>
<div :class="{ 'no-controls': this.$route.path==='/' }">
  <div id="content-container" v-touch:swipe.left="doHideMenu" v-touch:swipe.right="doShowMenu">
    <router-view :playback="playback" @showQueue="toggleQueue" ></router-view>
  </div>
  ...
</template>
<script>
...
export default {
  name: 'Main',
  ...
  props: [ 'isLoggedIn' ],
  methods: {
    toggleQueue (fixed = null) {
      this.showQueue = !this.showQueue
    },
    doShowMenu () {true
      this.showMenu = true
    },
    doHideMenu () {
      this.showMenu = false
    }
  }
}
</script>

However, the swipe gestures aren't working. When I had a look at the inspector in chrome, I can't see any events bound to the element other than the click and other basic events.

Any idea what I'm doing wrong?

Thanks!

@gilphilbert
Copy link
Author

gilphilbert commented May 4, 2021

I found out what I was doing wrong... I was in the wrong branch of my own repo. Turns out this doesn't work with Vue 2.x!

@robinrodricks
Copy link
Owner

robinrodricks commented May 4, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants