This package provides a simple Vue component for copying text to the user's clipboard. It is currently at version 1.0.3 and appears to be in a maintenance state, with no significant updates since 2020, specifically targeting Vue 2 environments. Its release cadence is very infrequent, reflecting its stable but dormant status. The component offers a declarative, straightforward way to integrate copy-to-clipboard functionality into Vue 2 applications, typically via a `text` prop and a `copy` event. Unlike newer solutions for Vue 3 (such as `vue-clipboard3` or `@vueuse/core`'s `useClipboard` composable), this library adheres to Vue 2's component model and is a direct wrapper, abstracting the underlying Clipboard API or `document.execCommand('copy')` for ease of use within its intended ecosystem.
npm install vue-copy-to-clipboardVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use the `CopyToClipboard` component in a Vue 2 template, binding text and handling the copy event to provide user feedback.
For Vue 3 projects, use a Vue 3 compatible library like `npm install vue-clipboard3` or `npm install @vueuse/core` and utilize their respective clipboard composables/components.
Ensure copy actions are initiated by a direct user gesture (e.g., a click event). Test thoroughly in various browser environments, especially HTTP origins.
Always use the default import syntax: `import CopyToClipboard from 'vue-copy-to-clipboard'`.
Ensure `CopyToClipboard` is added to the `components` property of your Vue component: `export default { components: { CopyToClipboard }, /* ... */ }`.Verify that the `onCopy` handler correctly accepts the `result` argument as defined in the component's documentation (which includes `text` and `isSuccess`).
Ensure copy operations are triggered by direct user interactions (e.g., button clicks). For automated testing, consider using browser automation tools that simulate user input.