Skip to content

v-copy

Function Introduction

Copy the passed value to the clipboard

Example

Value to be copied: Value to be copied

Usage

typescript
<script setup>
import { ref } from 'vue'

const change = ref('Changed value')
const value = ref('Value to be copied')
</script>

<template>
  <button v-copy="value">Click to copy</button>
  <input type="text" v-model="change"/>
  <button @click="() => value = change">
    Change the value to be copied
  </button>
</template>

Released under the MIT License.