
Security News
Oxlint Introduces Type-Aware Linting Preview
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
v-clipboard3
Advanced tools
Easily copy to clipboard in Vue 3 (composition-api) using clipboard.js 📋
Easily copy to clipboard in Vue 3 (composition-api) using clipboard.js 📋
npm install --save v-clipboard3
For vue-cli user:
import { createApp } from 'vue';
// If the directive scheme is not used, no global registration is required
import Clipboard from 'v-clipboard3';
const app = createApp(App);
app.use(Clipboard);
For standalone usage:
<script src="vue.min.js"></script>
<!-- must place this line after vue.js -->
<script src="dist/v-clipboard3.min.js"></script>
<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 lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
name: 'App',
setup() {
const message = '8888';
function onCopy(params: any) {
console.log(params);
}
function onError(params: any) {
console.log(params);
}
return { onCopy, onError, message };
},
});
</script>
<div id="app"></div>
<template id="t">
<div class="container">
<input type="text" v-model="message" />
<button type="button" @click="handleCopy">Copy!</button>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { useClipboard } from 'v-clipboard3';
export default defineComponent({
name: 'App',
setup() {
const message = '8888';
async function handleCopy() {
try {
await useClipboard(message);
alert('copy ok!');
} catch (error) {
console.log(error);
alert('copy error!');
}
},
return { handleCopy, message };
},
});
</script>
PRs welcome, and issues as well! If you want any feature that we don't have currently, please fire an issue for a feature request.
FAQs
Easily copy to clipboard in Vue 3 (composition-api) using clipboard.js 📋
We found that v-clipboard3 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
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.