记录
打印
const onPrint = () => {
const el = document.getElementById('tables');
const iframe = document.createElement('IFRAME');
let doc = null;
iframe.setAttribute('style', 'position:absolute;width:0px;height:0px;left:500px;top:500px;');
document.body.appendChild(iframe);
doc = iframe?.contentWindow.document;
doc.write(el.innerHTML);
doc.close();
iframe?.contentWindow.focus();
iframe?.contentWindow.print();
if (navigator.userAgent.indexOf('MSIE') > 0) {
document.body.removeChild(iframe);
}
};
下载
export async function downLoad(url: String) {
const iframe = document.createElement('iframe');
iframe.src = BASE_URL + url;
document.body.appendChild(iframe);
setTimeout(() => {
document.body.removeChild(iframe);
}, 1000);
return true;
}