我有一个为POS系统编写的Angular JS应用。我有一个模态窗口,弹出该窗口供用户打印收据。窗口弹出并在超时时调用window.print。我想从模态中打印的所有内容都会显示出来,但是由于某些原因,我仅在打印时才看到一个大盒子,它的内容下面有圆角。
我不确定解决此框的最佳方法,因为我在源代码中或屏幕上都没有看到它。我只在打印预览和打印页面中看到它。关于如何在那里检查实际html的任何想法?
打印CSS
@media print {
body * {
visibility:hidden;
}
.printSection, .printSection * {
visibility:visible;
}
.printSection {
position:absolute;
left:0;
top:0;
}
}
渲染的HTML
<div uib-modal-animation-class="fade" modal-in-class="in" ng-style="{'z-index': 1040 + (index && 1 || 0) + index*10}" uib-modal-backdrop="modal-backdrop" modal-animation="true" class="fade modal-backdrop in" style="z-index: 1040;"></div>
<div modal-render="true" tabindex="-1" role="dialog" class="modal fade ng-isolate-scope in" uib-modal-animation-class="fade" modal-in-class="in" ng-style="{'z-index': 1050 + index*10, display: 'block'}" uib-modal-window="modal-window" size="sm" index="0" animate="animate" modal-animation="true" data-vivaldi-spatnav-clickable="1" style="z-index: 1050; display: block;">
<div class="modal-dialog modal-sm" ng-class="size ? 'modal-' + size : ''"><div class="modal-content" uib-modal-transclude=""><table style="width: 3.125in; margin: 0.25in 0" id="receipt" class="printSection ng-scope">
<tbody>
<tr>
<td colspan="4" class="center ng-binding">2/25/2019 12:27 pm</td>
</tr>
<tr>
<td colspan="4" class="center ng-binding">Invoice #: 433</td>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="4" class="center ng-binding"></td>
</tr>
<!-- ngRepeat: item in rcptCtrl.invoice.details --><tr ng-repeat="item in rcptCtrl.invoice.details" style="vertical-align: top" class="ng-scope">
<td style="padding-right: 3px" class="right ng-binding">1</td>
<td class="ng-binding">Nerf</td>
<!-- ngIf: item.sourceTemplate !== 'PackageDetail' --><td class="right ng-binding ng-scope" ng-if="item.sourceTemplate !== 'PackageDetail'">
25.00
</td><!-- end ngIf: item.sourceTemplate !== 'PackageDetail' -->
<!-- ngIf: item.sourceTemplate !== 'PackageDetail' --><td class="right ng-binding ng-scope" ng-if="item.sourceTemplate !== 'PackageDetail'" style="padding-right: 3px">
25.00
</td><!-- end ngIf: item.sourceTemplate !== 'PackageDetail' -->
</tr><!-- end ngRepeat: item in rcptCtrl.invoice.details --><tr ng-repeat="item in rcptCtrl.invoice.details" style="vertical-align: top" class="ng-scope">
<td style="padding-right: 3px" class="right ng-binding">1</td>
<td class="ng-binding">Standard Group</td>
<!-- ngIf: item.sourceTemplate !== 'PackageDetail' --><td class="right ng-binding ng-scope" ng-if="item.sourceTemplate !== 'PackageDetail'">
105.00
</td><!-- end ngIf: item.sourceTemplate !== 'PackageDetail' -->
<!-- ngIf: item.sourceTemplate !== 'PackageDetail' --><td class="right ng-binding ng-scope" ng-if="item.sourceTemplate !== 'PackageDetail'" style="padding-right: 3px">
105.00
</td><!-- end ngIf: item.sourceTemplate !== 'PackageDetail' -->
</tr><!-- end ngRepeat: item in rcptCtrl.invoice.details --><tr ng-repeat="item in rcptCtrl.invoice.details" style="vertical-align: top" class="ng-scope">
<td style="padding-right: 3px" class="right ng-binding">10</td>
<td class="ng-binding">Test 0</td>
<!-- ngIf: item.sourceTemplate !== 'PackageDetail' -->
<!-- ngIf: item.sourceTemplate !== 'PackageDetail' -->
</tr><!-- end ngRepeat: item in rcptCtrl.invoice.details --><tr ng-repeat="item in rcptCtrl.invoice.details" style="vertical-align: top" class="ng-scope">
<td style="padding-right: 3px" class="right ng-binding">1</td>
<td class="ng-binding">Play</td>
<!-- ngIf: item.sourceTemplate !== 'PackageDetail' -->
<!-- ngIf: item.sourceTemplate !== 'PackageDetail' -->
</tr><!-- end ngRepeat: item in rcptCtrl.invoice.details --><tr ng-repeat="item in rcptCtrl.invoice.details" style="vertical-align: top" class="ng-scope">
<td style="padding-right: 3px" class="right ng-binding">1</td>
<td class="ng-binding">Electric Boogaloo</td>
<!-- ngIf: item.sourceTemplate !== 'PackageDetail' --><td class="right ng-binding ng-scope" ng-if="item.sourceTemplate !== 'PackageDetail'">
8.00
</td><!-- end ngIf: item.sourceTemplate !== 'PackageDetail' -->
<!-- ngIf: item.sourceTemplate !== 'PackageDetail' --><td class="right ng-binding ng-scope" ng-if="item.sourceTemplate !== 'PackageDetail'" style="padding-right: 3px">
8.00
</td><!-- end ngIf: item.sourceTemplate !== 'PackageDetail' -->
</tr><!-- end ngRepeat: item in rcptCtrl.invoice.details --><tr ng-repeat="item in rcptCtrl.invoice.details" style="vertical-align: top" class="ng-scope">
<td style="padding-right: 3px" class="right ng-binding">1</td>
<td class="ng-binding">Test 0</td>
<!-- ngIf: item.sourceTemplate !== 'PackageDetail' -->
<!-- ngIf: item.sourceTemplate !== 'PackageDetail' -->
</tr><!-- end ngRepeat: item in rcptCtrl.invoice.details -->
<tr>
<td colspan="3" class="right">Sub Total:</td>
<td class="right ng-binding">138.00</td>
</tr>
<!-- ngRepeat: tax in rcptCtrl.invoice.taxes --><tr ng-repeat="tax in rcptCtrl.invoice.taxes" class="ng-scope">
<td colspan="3" class="right ng-binding">Sales Tax:</td>
<td class="right ng-binding">11.47</td>
</tr><!-- end ngRepeat: tax in rcptCtrl.invoice.taxes -->
<tr>
<td colspan="3" class="right">Total:</td>
<td class="right ng-binding">149.47</td>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
<!-- ngRepeat: payment in rcptCtrl.payments --><tr ng-repeat="payment in rcptCtrl.payments" class="ng-scope">
<td colspan="3" class="right ng-binding">Cash:</td>
<td class="right ng-binding">149.47</td>
</tr><!-- end ngRepeat: payment in rcptCtrl.payments -->
<tr>
<td colspan="3" class="right">Total Payments:</td>
<td class="right ng-binding">149.47</td>
</tr>
<tr>
<td colspan="3" class="right">Change:</td>
<td class="right ng-binding">0.00</td>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="4" class="center">
<span ng-bind-html="rcptCtrl.blurb | toTrusted" class="ng-binding"><div>Boo Yah!</div><div> </div><div>Boo Yah! </div></span>
</td>
</tr>
</tbody></table></div></div>
</div>
答案 0 :(得分:0)
您可以使用开发工具将设备渲染设置为特定的工作表,然后检查dom来调试问题。