Bootstrap

clipboard 实现复制 粘贴功能

<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("复制失败");
    });
    // clipboard.destroy();
  },
  destroyed() {
    this.clipboard.destroy();
  },
<script>
;