document.execCommand("copy")復制鏈接或文本


<div v-if="type != 2" ref="qrcode" :class="['link-code',[manuscript.manuscriptType==2?'link-code-poster':'']]" @click="copyLink" @mouseenter="scaleMax" @mouseleave="scaleMin"></div>
<input id="copyLinkInput" class="copy-input"/>
.link-code {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 70px;
  height: 70px;
}
.copy-input {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  z-index: -10;
}
    // 點擊二維碼復制鏈接
    copyLink() {
      var _this = this;
      var $linkInput = $('#copyLinkInput');

      $linkInput.val(_this.previewUrl);
      $linkInput.select();
      document.execCommand("copy");
      setTimeout(function () {
          _this.$message.success('復制鏈接成功!')
      }, 100)
    },




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM