Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

[Vue warn]: Failed to resolve directive: clipboard

Tags:

vue.js

nuxt.js

I'm using https://github.com/zhuowenli/vue-clipboards. But when i tried this it doesn't work. I'm new to vue and nuxt js. and there is an error on the console that says [Vue warn]: Failed to resolve directive: clipboard. BTW i have already installed clipboard.

Template

<button v-clipboard='message'>Copy</button>

Script

import VueClipboards from 'vue-clipboards'
export default {
  components: { VueClipboards },
  data () {
    return {
      message: 'asdad'
      }
    }
  }
like image 515
James Deak Avatar asked Dec 05 '25 14:12

James Deak


1 Answers

This same issue is mentioned here: https://github.com/Inndy/vue-clipboard2/issues/4

You can solve it adding the component in the main.js file. By doing that, you are making it global.

https://vuejsfeed.com/blog/copy-texts-to-clipboard-using-vue-clipboard2

Best regards

like image 64
Lv1z Avatar answered Dec 07 '25 18:12

Lv1z



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!