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

v-clipboard

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v-clipboard

Vue.js Clipboard Plugin

  • 3.0.0-next.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25K
decreased by-0.77%
Maintainers
1
Weekly downloads
 
Created
Source

npm npm

Vue Clipboard

Demo

https://codesandbox.io/s/epic-waterfall-17yet5?file=/src/App.vue

Install

npm install --save v-clipboard
yarn add v-clipboard
import Vue from 'vue'
import Clipboard from 'v-clipboard'

Vue.use(Clipboard)

Using

When an element that contains v-clipboard directive is clicked, the value of value will be copied into clipboard.


Copying static value (directive should receive actual value):

<button v-clipboard="value">
  Copy to clipboard
</button>
<button v-clipboard="'some text'">
  Copy to clipboard
</button>

Copying dynamic value (directive should recieve a function that returns value):

<button v-clipboard="() => value">
  Copy to clipboard
</button>

Copying anything in your methods:

this.$clipboard(value)

Without plugin:

import { Clipboard } from "v-clipboard"

Clipboard.copy(value)

Events

<button v-clipboard="foo"
        v-clipboard:success="clipboardSuccessHandler"
        v-clipboard:error="clipboardErrorHandler">
  Copy to clipboard
</button>
{
  methods: {
    clipboardSuccessHandler ({ value, event }) {
      console.log('success', value)
    },

    clipboardErrorHandler ({ value, event }) {
      console.log('error', value)
    }
  }
}

Compatibility

Keywords

FAQs

Package last updated on 16 Dec 2022

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