美文网首页
Vue 点击复制

Vue 点击复制

作者: 不知荼 | 来源:发表于2020-04-09 14:17 被阅读0次
<div>{{orderNumber}}<span @click="copy(orderNumber)">复制</span></div>
copy(orderNumber){
      console.log('复制')
      let url = orderNumber;
      let oInput = document.createElement('input');
      oInput.value = url;
      document.body.appendChild(oInput);
      oInput.select();
      document.execCommand("Copy");
      this.$dialog.toast({ mes: "复制成功", timeout: 500 });
      oInput.remove();
}

相关文章

网友评论

      本文标题:Vue 点击复制

      本文链接:https://www.haomeiwen.com/subject/dulcmhtx.html