@uone/u-clip
v1.1.0
Published
文本的复制功能
Downloads
4
Readme
test-copied
说明:文本复制
兼容性:支持Chrome42+, edge12+, IE9+, Firefox41+, Opera29+, Safari10+
main引入:
const Clipboard = require('clipboard')
Example
<template>
<button class="btn" data-clipboard-text="我是复制的文本" @click="handleCopy">
点我复制
</button>
</template>
<script>
export default {
name: 'App',
methods: {
handleCopy () {
let clipboard = new Clipboard(".btn")
clipboard.on('success', () => {
console.log('复制成功')
})
clipboard.on('error', () => {
console.log('复制失败')
})
}
}
}
</script>