Vue 点击复制

2020-04-09  本文已影响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();
}
上一篇下一篇

猜你喜欢

热点阅读