📋 Vue2.0 directive to copy or cut text to clipboard.
Vue wrapper for clipboard.js.
DEMO: https://zhuowenli.github.io/vue-clipboards/
$ npm install vue-clipboards
import VueClipboards from 'vue-clipboards';
Vue.use(VueClipboards);
new Vue({
data() {
return {
copyData: 'copy data'
}
}
});
<button v-clipboard="copyData">Copy</button>
<button v-clipboard="copyData" @success="handleSuccess" @error="handleError">Copy</button>
import VueClipboards from 'vue-clipboards';
Vue.use(VueClipboards);
new Vue({
data() {
return {
copyData: 'copy data'
}
},
methods: {
handleSuccess(e) {
console.log(e);
},
handleError(e) {
console.log(e);
},
}
});
yarn dev
: Run example in development modeyarn deploy
: Deploy example to gh-pagesyarn build:cjs
: Build component in commonjs formatyarn build:umd
: Build component in umd formatyarn build
: Build component in both format
Check out your npm scripts, it's using vbuild under the hood.
Generated by create-vue-app