vue 复制链接功能

时间:2020-06-18 12:05:13   收藏:0   阅读:367
//复制链接
copyUrl(index) {
      if (this.couponList[index].status == 2) {
        this.$sweetalert.errorAlert("警告", "该优惠券暂不可用");
        return;
      }
      var id = this.couponList[index].couponId;
      var url =
        this.Global.url + "/BusinessCenter/CouponCollection?couponId=" + id;
      var oInput = document.createElement("input");
      oInput.value = url;
      document.body.appendChild(oInput);
      oInput.select(); // 选择对象
      document.execCommand("Copy"); // 执行浏览器复制命令
      oInput.className = "oInput";
      oInput.style.display = "none";
      this.$toastr.tipSuccess("复制成功","消息提示");
    }
  },

  

原文:https://www.cnblogs.com/xiaoxiaomini/p/13156605.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!