vue-clipboards

1.3.0 • Public • Published

vue-clipboard

📋 Vue2.0 directive to copy or cut text to clipboard.

Vue wrapper for clipboard.js.

DEMO: https://zhuowenli.github.io/vue-clipboards/

Install

$ npm install vue-clipboards

Usage

import VueClipboards from 'vue-clipboards';
 
Vue.use(VueClipboards);
 
new Vue({
    data() {
        return {
            copyData: 'copy data'
        }
    }
});
<button v-clipboard="copyData">Copy</button>

Event

<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);
        },
    }
});

Development

  • yarn dev: Run example in development mode
  • yarn deploy: Deploy example to gh-pages
  • yarn build: Build component in umd & es format
  • yarn watch: Build component in umd & es format with watch mode

Check out your npm scripts, it's using vbuild under the hood.


Generated by create-vue-app

Readme

Keywords

none

Package Sidebar

Install

npm i vue-clipboards

Weekly Downloads

4,492

Version

1.3.0

License

MIT

Unpacked Size

63.5 kB

Total Files

5

Last publish

Collaborators

  • caigua
  • zwlo