VUE 点击按钮复制input里的内容到剪贴板
<p>邀请码</p><p class="inviteCode" id = "inviteCode">{{invite_code}}</p><p class="copy" @click="copy">复制</p>copy() {var Url2 = document.getElementById("inv...
·
<p>邀请码</p>
<p class="inviteCode" id = "inviteCode">{{invite_code}}</p>
<p class="copy" @click="copy">复制</p>
copy() {
var Url2 = document.getElementById("inviteCode").innerText;
var oInput = document.createElement("input");
oInput.value = Url2;
document.body.appendChild(oInput);
oInput.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
oInput.className = "oInput";
oInput.style.display = "none";
msg("复制成功");
}
更多推荐
已为社区贡献3条内容
所有评论(0)