Vue Clipboard-2 Installation on Quasar 1.0



  • Has anybody been able to make this popular Vue Clipboard2
    plugin work for Quasar v.1? All the instructions explain how to install it by editing main.js, but Quasar 1.0 doesn’t have main.js anymore. So, I’ve tried to adapt the old installation instructions to the new boot files instructions as follows:

    // $ quasar new boot VueClipboard
    
    // Then in the boot/VueClipboard.js file:
    
    import VueClipboard from 'vue-clipboard2';
    
    export default async ({ Vue }) => {
      Vue.prototype.$VueClipboard = VueClipboard;
    };
    
    // Then in quasar.conf.js
    
    boot: [ // Boot files are pulled from the boot folder.
          "axios",
          "VueClipboard"
        ]
    

    Everything seems to be installed fine because my app loads without any compile-time errors, but when I try to use the plugin with the v-clipboard:copy directive in my template, the plugin doesn’t work and I always get this error:

    Failed to resolve directive: clipboard.

    I also tried using a similar plugin, but I got the same error. So, I’m wondering if there is a problem within the new Quasar plugin system or if I’m just not installing the plugins correctly.

    Can somebody please help?



  • @Julia try

    import VueClipboard from 'vue-clipboard2';
    
    export default async ({ Vue }) => {
      Vue.use(VueClipboard)
    };
    


  • I tried that previously and got some other error, but I just tried it again and it worked. I guess when I tried it before there was some other co-existing config problem.

    Anyway, that resolves the problem. Thank you very much for your help!


Log in to reply