一键复制的实现

230 阅读1分钟
var input = document.createElement("input");
input.value  = '一键复制功能'
document.body.appendChild(input)
input.select()      //选中所有在`<input>`元素中的文字
if (document.execCommand("copy")) {
        message.success("成功复制授权链接");
}