適合需要復(fù)制地址到第三方打單軟件,比如拼多多、淘寶、抖店等等第三方打單軟件打印快遞單發(fā)貨的。
效果如下
//復(fù)制地址
copy: function() {
let that = this;
let copyText = this.orderDatalist.orderInfo.real_name + ',' + this.orderDatalist.orderInfo.user_phone + ',' + this.orderDatalist.orderInfo.user_address
console.log('復(fù)制成功',copyText)
const input = document.createElement('input');
document.body.appendChild(input);
input.setAttribute('value',copyText);//這里是數(shù)據(jù)
input.setAttribute('create',1);
input.select();
document.execCommand("Copy");
var list=document.getElementsByTagName('input')
var inputList = Array.prototype.slice.call(list)
inputList.forEach((item)=>{
if(item.getAttribute('create'))document.body.removeChild(item);
});
this.$Message.info('復(fù)制成功→' + copyText); //彈窗提醒復(fù)制成功,不需要可注釋
},