cashier_desktop/public/print.html

65 lines
1.8 KiB
HTML

<!--
~ Copyright (c) 2023. Author Hubert Formin <2399270194@qq.com>
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Print preview</title>
<style>
section {
font-size: 24px;
}
</style>
</head>
<body>
<div id="app">
<div class="html2canvas" style="position: fixed;top: -1000%;">
<section style="font-size: 22px;">#B1 B2</section>
<section style="font-size: 22px;">喔喔奶茶 x12</section>
<section style="font-size: 22px;">麻辣味</section></section></section>
<section style="font-size: 22px;">03-08 16:32 ¥123.00</section>
</div>
</div>
<script type="module">
const { ipcRenderer } = require("electron");
// import {
// createApp,
// ref,
// onMounted,
// } from "../node_modules/vue/dist/vue.esm-browser.js";
import html2canvas from '../node_modules/html2canvas/dist/html2canvas.esm.js'
html2canvas(document.querySelector('.html2canvas')).then(canvas => {
console.log(canvas)
document.querySelector('#app').appendChild(canvas)
}).catch(err=> {
console.log(err);
})
// createApp({
// setup() {
// const data = ref({});
// onMounted(() => {
// ipcRenderer.on("getParams", (event, arg) => {
// // console.log(arg);
// data.value = JSON.parse(arg);
// setTimeout(() => {
// ipcRenderer.send("printStart");
// },500)
// });
// });
// return {
// data,
// };
// },
// }).mount("#app");
</script>
</body>
</html>