user1820007
user1820007

Reputation:

How to implement touch prop in Window component in vuetify?

https://vuetifyjs.com/en/components/windows#windows

<v-window
   v-model="window"
   :touch = "swipe"        
>

How to provide a custom left and right function when swiped left or right? The way I did is not working because I cannot access the variables I need and cannot call functions in methods.

export default {
  name :'test',
  data() {
    return {
      window: 0,
      length1:20,
      swipe: {
        length2:11,
        left: function() {
            //access both length1 and length2 here//
        },
        right:  function() {

        },
     }
    };

Upvotes: 4

Views: 901

Answers (1)

Adi Gonnen
Adi Gonnen

Reputation: 113

You can call functions directly from v-window with :touch, instead of data.
Works for me.

<v-window
   v-model="window"
   :touch="{left: onSwipeLeft, right: onSwipeRight}"        
>
methods: {
  onSwipeLeft() {
   //do something with this.length1  or this.length2
  },
  onSwipeRight() {
   //exc
  }
}

Upvotes: 1

Related Questions