Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-clipboard2

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-clipboard2

A Vuejs2 binding for clipboard.js

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
101K
decreased by-0.88%
Maintainers
1
Weekly downloads
 
Created
Source

vue-clipboard2

A simple vuejs 2 binding for clipboard.js

Install

npm install --save vue-clipboard2 or use dist/vue-clipboard.min.js without webpack

Usage

For vue-cli user:

import Vue
import VueClipboard from 'vue-clipboard2'

Vue.use(VueClipboard)

For standalone usage:

<script src="vue.min.js"></script>
<!-- must place this line after vue.js -->
<script src="dist/vue-clipboard.min.js"></script>

Sample

<div id="app"></div>

<template id="t">
  <div class="container">
    <input type="text" v-model="message">
    <button type="button"
      v-clipboard:copy="message"
      v-clipboard:success="onCopy"
      v-clipboard:error="onError">Copy!</button>
  </div>
</template>

<script>
new Vue({
  el: '#app',
  template: '#t',
  data: function () {
    return {
      message: 'Copy These Text'
    }
  },
  methods: {
    onCopy: function (e) {
      alert('You just copied: ' + e.text)
    },
    onError: function (e) {
      alert('Failed to copy texts')
    }
  }
})
</script>

I want to copy texts without a specific button!

Yes, you can do it by using our new method: this.$copyText. see sample2.

Modern browser have some limiation like that you can't use window.open without a user iteraction. So there's a same restriction on copy things! Test it before you use it. Make sure you are not using this method inside any async method.

Use it before reading this issue and this page.

Contribution

PRs welcome, and issues aswell! If you want any feature that we don't have currently, please create a issue for feature request.

License

MIT License

Keywords

FAQs

Package last updated on 19 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc