我有一个带有export
按钮的简单应用程序。单击此按钮后,打开一个弹出窗口以添加更多数据,并使用JsPDF
创建pdf。
当我单击export
按钮时,弹出窗口会正确显示,但是单击finish
按钮(将其关闭),则该错误会出现在控制台上:
fs.js:114 Uncaught Error: ENOENT: no such file or directory, open
at Object.openSync (fs.js:436)
at Object.module.(anonymous function) [as openSync] (ELECTRON_ASAR.js:160:31)
at Object.readFileSync (fs.js:341)
at Object.fs.readFileSync (ELECTRON_ASAR.js:580)
at Object.exports.base64Sync (/Users/th3g3ntl3man/Repository/thermowell-design/node_modules/base64-img/base64-img.js:60)
at HTMLButtonElement.$.on (export.min.js:1)
at HTMLDocument.dispatch (jquery-3.3.1.min.js:2)
at HTMLDocument.y.handle (jquery-3.3.1.min.js:2)
这是一个与export
按钮链接的小代码:
const JsPDF = require('jspdf');
let customer, project, tag;
var pdf = new JsPDF();
$(document).ready( () => {
$(document).on("click","#additionalData", () => {
customer = $('#customer').val().trim();
tag = $('#tag').val().trim();
pN = $('#pN').val().trim();
pdf.text(50, 50, 'this is a test');
pdf.save(customer + '_' + tag + '.pdf');
$("#custom-modal").modal("hide");
});
$('#esporta').click( () => {
$("#custom-modal").modal("show");
});
});
additionalData
是插入新数据的形式,而custom-modal
是弹出窗口。