<el-form-item label="ticketKey">
<span id="code">{{ baseForm.ticketKey }}</span>
<span class="copy-link" data-clipboard-target="#code">复制</span>
</el-form-item>
<script>
const clipboard = null;
import Clipboard from "clipboard";
mounted() {
const that = this;
that.clipboard = new Clipboard(".copy-link");
that.clipboard.on("success", function (e) {
that.$message.success("复制成功");
});
that.clipboard.on("error", function (e) {
that.$message.success("复制失败");
});
},
destroyed() {
this.clipboard.destroy();
},
<script>