<span @click="copy(myCouponInfo.couponId)">点击复制</span>
copy(val) {
console.log(val);
const textarea = document.createElement("textarea");
textarea.setAttribute("readonly", "readonly");
textarea.value = val;
document.body.appendChild(textarea);
textarea.select();
if (document.execCommand("copy")) {
document.execCommand("copy");
this.$toast("复制成功");
}
document.body.removeChild(textarea);
},
vue如何实现点击复制
最新推荐文章于 2024-07-06 23:51:02 发布