
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@soerenmartius/vue3-clipboard
Advanced tools
Clipboard.js bindings for Vue 3.
This repository is a port of Inndy's vue-clipboard2 plugin for Vue3.
npm install --save @soerenmartius/vue3-clipboard
v-clipboard
directive globallysrc/main.ts
import { createApp } from 'vue'
import App from './App.vue'
import VueClipboard from '@soerenmartius/vue3-clipboard'
createApp(App).use(VueClipboard).mount('#app')
v-clipboard
directive for a specific component<template>
<input v-model="value" />
<button v-clipboard="value">Copy</button>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue'
export default defineComponent({
setup() {
const value = ref('lorem')
return { value }
},
})
</script>
<template>
<input v-model="value" />
<button
v-clipboard:copy="value"
v-clipboard:success="onSuccess"
v-clipboard:error="onError"
>
Copy
</button>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue'
export default defineComponent({
setup() {
const value = ref('lorem')
const onSuccess = () => {
console.log('success')
}
const onError = () => {
console.log('error')
}
return { value, onSuccess, onError }
},
})
</script>
<template>
<input v-model="value" />
<button @click="toClipboard(value)">Copy</button>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue'
import { toClipboard } from '@soerenmartius/vue3-clipboard'
export default defineComponent({
setup() {
const value = ref('lorem')
return { value, toClipboard }
},
})
</script>
Contributions are always encouraged and welcome! For the process of accepting changes, we use Pull Requests. For feature requests please fill an issue.
FAQs
A Vue 3 binding for clipboard.js
The npm package @soerenmartius/vue3-clipboard receives a total of 3,089 weekly downloads. As such, @soerenmartius/vue3-clipboard popularity was classified as popular.
We found that @soerenmartius/vue3-clipboard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.