0
我有這樣的方法:如果在打印對話框中單擊取消,如何關閉選項卡?
print(data): void{
let printContents, popupWin;
let trHtml = '';
for (let entry of data) {
trHtml += `<tr>
<td>` + entry.aaabroj + `</td>
<td>` + entry.bbbbroj + `</td>
<td>` + entry.sifratipa + `</td>
<td>` + entry.vrijemepoziva + `</td>
<td>` + entry.trajanjepoziva + `</td>
<td>` + entry.iznoskm + `</td>
</tr>`;
}
window.open('', 'popupWin', '');
window.print();
popupWin.document.write(`
<html>
<head>
<title>Detaljni izvještaj</title>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
</head>
<body>
<table>
<tr>
<th>Pretp.broj</th>
<th>Pozvani broj</th>
<th>Tip poziva</th>
<th>Start</th>
<th>Količina</th>
<th>Cijena</th>
</tr>
`+trHtml+`
</table>
</body>
</html>`);
}
現在我在打印對話框中打開表,但是當用戶點擊取消關閉打印對話框,但標籤仍然是開放的。任何建議如何關閉該標籤呢?