0.0.1 • Published 7 years ago

vcopy v0.0.1

Weekly downloads
13
License
ISC
Repository
github
Last release
7 years ago

Vcopy

A simple vue plugin use for copy.

npm i vcopy --save

import Vue from 'vue'
import vcopy from 'vcopy'

Vue.use(vcopy, {
  // directive name
  name: 'copy',
  // success tip
  success: function () {
    alert('copy success')
  },
  // failure tip
  failure: function () {
    alert('copy failure')
  },
  // format copy content
  formater: function (v) {
    return String(v)
  }
})

<template>
  <div id="app">
    <textarea v-model="msg"></textarea>
    <button v-copy="msg">COPY</button>
  </div>
</template>

<script>
export default {
  name: 'app',
  data () {
    return {
      msg: 'Welcome to Your'
    }
  }
}
</script>