npm install --save vue3-clipboard or use dist/vue3-clipboard.min.js without npm
Usage
For vue-cli user:
import{createApp}from'vue'
importVueClipboardfrom'vue3-clipboard'
constapp=createApp({})
app.use(VueClipboard)
For standalone usage:
<scriptsrc="vue.min.js"></script>
<!-- must place this line after vue.js -->
<scriptsrc="dist/vue3-clipboard.min.js"></script>
I want to copy texts without a specific button!
Yes, you can do it by using our new method: this.$copyText,
where we replace the clipboard directives with a v-on directive.
Modern browsers have some limitations like that you can't use window.open without a user interaction.
So there's the same restriction on copying things! Test it before you use it. Make sure you are not
using this method inside any async method.