vue实现打印后的页面直接打印
export function getBlobResult(data) {
const binaryData = [];
binaryData.push(data);
let blob = new Blob(binaryData, { type: data.type })
console.log("data.type", data.type)
if (data.type == "application/pdf") {
let urlPdf = window.URL.createObjectURL(blob);
let newWindow = window.open(urlPdf, '__blank');
newWindow.document.close();
newWindow.print();
} else {
const reader = new FileReader();
reader.readAsText(blob, 'utf-8');
reader.onloadend = function () {
let errorMsg = reader.result.substring(9);
Message.error(errorMsg)
}
return;
}
return "";
}