Numbers Probably Matter

    vue-reactive-clipboard
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.4 • Public • Published

    vue-reactive-clipboard

    A minisize vue2/3 reactive clipboard

    Install

    Install with yarn:

    $ yarn add vue-reactive-clipboard

    Install with npm:

    $ npm i vue-reactive-clipboard --save

    Usage

    Vue3

    <template>
      <p @click="copy(content)"> {{ content }} </p>
    </template>
    
    <script setup lang="ts">
    import { ref, watchEffect } from 'vue'
    import { useClipboard } from 'vue-reactive-clipboard'
    const { text, copy } = useClipboard()
    
    const content = ref('click me to copy!')
    watchEffect(() => {
      if (text.value) {
        console.log('copy successed: ' + text.value)
      }
    })
    </script>

    Vue2

    Install @vue/composition-api as a dependency.

    <template>
      <div>
        <p @click="copy(content)"> {{ content }} </p>
      </div>
    </template>
    
    <script>
    import { ref, watchEffect, defineComponent } from '@vue/composition-api'
    import { useClipboard } from 'vue-reactive-clipboard'
    export default defineComponent({
      setup () {
        const { text, copy } = useClipboard()
        const content = ref('click me to copy!')
        watchEffect(() => {
          if (text.value) {
            console.log('copy successed: ' + text.value)
          }
        })
        return {
          content,
          copy
        }
      }
    })
    </script>

    Install

    npm i vue-reactive-clipboard

    DownloadsWeekly Downloads

    7

    Version

    0.0.4

    License

    MIT

    Unpacked Size

    4.03 kB

    Total Files

    5

    Last publish

    Collaborators

    • cinob