1.NPM
npm install --save vue-clipboard2
2.页面引入
import VueClipboard from 'vue-clipboard2'
3.html+dom
<img class="copyIconSvg" src="@/images/svgIcon/copyIcon.svg" alt="" ref="copyButton"
v-clipboard:copy="detailPOC.poc_code" //需要复制的内容
v-clipboard:success="onCopy"
v-clipboard:error="onError">
onCopy(e) {
this.$message.success('复制成功!');
},
onError(e) {
this.$message.error('复制失败!');
}