前端js实现复制功能

// 复制内容的方法
      copyUrl(){
        let input=document.createElement('input');
        input.value='复制内容';
        document.body.appendChild(input);
        input.select();
        document.execCommand('Copy');
        input.style.display='none';
        this.$message({
          type: 'success',
          message: '复制链接成功!'
        })
      },
原文地址:https://www.cnblogs.com/Alex-Song/p/15238460.html