<template> <text class="copyText" @click.stop="copyText">复制</text> </template> <script> import clipboard from "@/js_sdk/dc-clipboard/clipboard.js" export default{ props:{ text: { type: String, default: '' }, label: { type: String, default: '' }, }, methods:{ // 复制 copyText(){ clipboard.setText(this.text); uni.showToast({ icon: 'none', title: this.label + '已复制成功' }) }, } } </script> <style> .copyText{ font-size: 20upx; color:#333; margin-left: 20upx; background: #c1c1bf; font-weight: normal; padding: 0 5upx; border-radius: 5upx; color: #fff; } </style>