feat:面单打开新页面
This commit is contained in:
1 parent
06bb6e9f44
commit
e7544d1db1
1 file changed
+9
-12
@@ -153,14 +153,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 添加操作按钮 -->
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="showLabelDialog = false">关闭</el-button>
|
||||
<el-button type="primary" @click="openInNewWindow">在新页面打开</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
@@ -401,29 +393,34 @@ const openInNewWindow = () => {
|
||||
}
|
||||
.print-btn {
|
||||
display: none;
|
||||
height: 50px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="print-btn">
|
||||
<button onclick="window.print()">打印</button>
|
||||
</div>
|
||||
<img src="${imageUrl}" alt="物流面单" class="label-img" />
|
||||
<div class="custom-text">
|
||||
${productText}
|
||||
</div>
|
||||
<div class="print-btn">
|
||||
<button onclick="window.print()">打印</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
|
||||
// 在新窗口中打开
|
||||
const newWindow = window.open('', '_blank', 'width=800,height=600,scrollbars=yes,resizable=yes')
|
||||
const newWindow = window.open('', '_blank', 'scrollbars=yes,resizable=yes')
|
||||
if (newWindow) {
|
||||
newWindow.document.write(htmlContent)
|
||||
newWindow.document.close()
|
||||
// 窗口最大化
|
||||
newWindow.moveTo(0, 0)
|
||||
newWindow.resizeTo(screen.width, screen.height)
|
||||
// 关闭当前弹窗
|
||||
showLabelDialog.value = false
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user