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

[Bug Report] V-Touch directive is broken in 2.0 #130

Closed
cmseeling opened this issue Jul 25, 2019 · 29 comments
Closed

[Bug Report] V-Touch directive is broken in 2.0 #130

cmseeling opened this issue Jul 25, 2019 · 29 comments
Assignees
Labels

Comments

@cmseeling
Copy link

Environment

Vuetify Version: 2.0.1
Vue Version: 2.6.10
Browsers: Chrome 75.0.3770.142
OS: Windows 10

Steps to reproduce

Add a v-touch directive to a component.

Expected Behavior

V-touch directive works with touch inputs.

Actual Behavior

V-touch throws exception: "Failed to resolve directive: touch"

Reproduction Link

https://github.com/cmseeling/vuetify-touch-issue

@johnleider
Copy link
Member

So I spent quite a bit of time on this and I could not reproduce the issue whatesoever outside of that environment. So I decided to strip the application down to a basic js one, and it was still having the import issue. At this point, I'm honestly not sure, but I can confirm that 2 of my recent apps, one is brand new and one is recently upgraded, it worked as expected.

@cmseeling
Copy link
Author

I just tried creating a new project with no custom settings selected (no TypeScript, no vuex or router) through the Vue CLI and still get the error when adding the v-touch directive.

Are there differences in the package-lock file between your clean app that works and the file in the reproduction repo?

For reference, here's a picture of the options I selected when creating the reproduction repo:
cmd_Z6IufZ1RnT

@KaelWD
Copy link
Member

KaelWD commented Jul 26, 2019

Update vue-cli and try again?

@rounce
Copy link

rounce commented Jul 26, 2019

I have the same issue, only manual import of the touch directive helped. vue-cli version is 3.9.3.
I can confirm that 2 of my recent apps, one is brand new (vue create test; cd test; vue add vuetify with default features; yarn serve) and one is recently upgraded, it worked not as expected.

@cmseeling
Copy link
Author

I upgraded my vue-cli version to 3.9.3 and generated a new app with all of the defaults selected, and the problem is still there.

@libid0nes
Copy link

Similar issue after upgrading to 2.0

[Vue warn]: Failed to resolve directive: touch

(found in <App> at src/App.vue)

My code hasn't changed since the migration, and it looks like this:

// App.vue
<v-layout v-touch="{ right: () => SwipeRight(), left: () => SwipeLeft() }">
    ...
</v-layout>  

Vuetify Version: 2.0.0
Vue Version: 2.6.10
Vue CLI : 3.9.3
Browsers: Chrome 74.0.3729.169
OS: Windows 10 1903

@razorfever
Copy link

I don't know if this is related but I was having similar issue with the scroll directive.
I was able to fix it by going "old school" and manually definining the directives like this:

// plugins/vuetify.js
import Vuetify from 'vuetify/lib';
import { Ripple, Scroll } from 'vuetify/lib/directives';

Vue.use(Vuetify, {
  directives: {
    Ripple,
    Scroll,
  },
});

export default new Vuetify({ ... });

@struers-mfr
Copy link

I have same issue, I have latest vue-cli 3.10.0 also tried what @razorfever suggests
to import { Touch } from 'vuetify/lib/directives'
and use it in vuetify object under directives in plugin spec but with no luck

@mseele
Copy link

mseele commented Aug 28, 2019

I have the same issue (after upgrading from vuetify 1.5).

Adding

// plugins/vuetify.js
import { Touch } from 'vuetify/lib/directives'

Vue.use(Vuetify, {
  directives: {
    Touch
  }
})

...

fixes it.

@TheFrogDaddy
Copy link

import { Touch } from 'vuetify/lib/directives'

This doesn't work for me, any updates on this or other workarounds?

@jperelli
Copy link

Same for me, It doesn't work. Full report:

// main.ts

import Vuetify, { ... } from 'vuetify/lib'
import { Ripple, Touch } from 'vuetify/lib/directives'
...
Vue.use(Vuetify, {
  components: {
  ...
  },
  directives: {
    Touch,
  },
  theme: {
    primary: '#51B2E0',
  },
})
...
const vueInstance = new Vue({
  vuetify,
  ...
  render: h => h(App),
})
document.addEventListener('DOMContentLoaded', function () {
  vueInstance.$mount('#app')
})
export default vueInstance
// component.vue
...
      <span
        class="card"
        @click="toggleSmallResults"
        v-touch="{
          left: nextResult,
          right: prevResult
        }">
...

Traceback:

vue.runtime.esm.js?2b0e:619 [Vue warn]: Failed to resolve directive: touch

(found in <RecorridosResultList> at src/components/ABSearchResults/RecorridosResultList.vue)

@lebesnec
Copy link

same error with the v-resize directive...

@lebesnec
Copy link

lebesnec commented Dec 2, 2019

upgraded vuetify to 2.1.12 and vuetify-loader to 1.4.2 and it's working now.

@TimV81
Copy link

TimV81 commented Dec 6, 2019

I'm on vuetify 2.1.13 and vuetify-loader 1.4.3 but still can't get the v-touch directive working, either with or without the manual plugin.js modification. I've got the v-touch directive implemented on a v-list-item

@lebesnec
Copy link

lebesnec commented Dec 6, 2019

I'm on vuetify 2.1.13 and vuetify-loader 1.4.3 but still can't get the v-touch directive working, either with or without the manual plugin.js modification. I've got the v-touch directive implemented on a v-list-item

did you try the import syntax from @mseele ? This one :
https://github.com/vuetifyjs/vuetify/issues/8027#issuecomment-525850033

It is working for me with the Resize directive with vuetify 2.1.12 and vuetify-loader 1.4.2.

@TimV81
Copy link

TimV81 commented Dec 6, 2019

did you try the import syntax from @mseele ? This one :
#8027 (comment)

It is working for me with the Resize directive with vuetify 2.1.12 and vuetify-loader 1.4.2.

Yes, but didn't work.

update: this actually does work. I placed the reference in the constructor instead of the use.Vue() call.

@jperelli
Copy link

Same for me, It doesn't work. Full report:

Sorry, I also configured it wrongly. I followed all the instructions again and it worked!

@ghansham
Copy link

ghansham commented May 2, 2020

It seems it is still broken in the latest version of vuetify 2.2.26 and vuetify loader 1.4.3. Any update on this? Do we have support for swipeable components in vuetify?

@ghansham
Copy link

ghansham commented May 2, 2020

Either way it does not work. whether using Vue.use call or passing reference to the constructor

@libid0nes
Copy link

In my case, it only works like this:

import Vue from '../../node_modules/vue';
import Vuetify from 'vuetify/lib';
import { Touch } from 'vuetify/lib/directives';

Vue.use(Vuetify, {
  directives: {
    Touch,
}});

export default new Vuetify({
  theme: {
      options: {
        customProperties: true,
      },
      dark: true,
  },
  icons: {
    iconfont: 'fa' && 'md',
  },
});

@ghansham
Copy link

ghansham commented May 2, 2020 via email

@libid0nes
Copy link

libid0nes commented May 2, 2020

Which vuetify version and loader version are you using? And any idea about swipeable controls in vuetify?

I use:

    "vuetify": "^2.2.26",
    "vuetify-loader": "^1.4.3",
    "vue-cli-plugin-vuetify": "~2.0.5",

Swipeable in App.vue:

<template>  
  <v-app> 
  <v-layout v-touch="{ right: () => SwipeRight(), left: () => SwipeLeft(), down: () => SwipeBottom(), up: () => SwipeTop() }">
  <v-content>
      ...
  </v-content>
  </v-layout>  
  </v-app>
</template>

@ghansham
Copy link

ghansham commented May 2, 2020 via email

@ajslater
Copy link

Adding the Touch directive to the Vue.use config wfm.

@ghansham

This comment has been minimized.

@ghansham

This comment has been minimized.

@dannycoulombe
Copy link

I confirm that I also have this issue under 2.2.27. Importing Touch from vuetify/lib/directives also didn't worked for me.

@manonthemat
Copy link

Same problem in 2.2.29.

@xahmedtaha
Copy link

xahmedtaha commented May 25, 2020

Same problem in version 2.2.29

@KaelWD KaelWD transferred this issue from vuetifyjs/vuetify May 26, 2020
@KaelWD KaelWD self-assigned this May 26, 2020
@KaelWD KaelWD added the bug label May 26, 2020
@KaelWD KaelWD closed this as completed in e353643 May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests