Tag: 语义

电子脚本中的loadhtml而不是loadUrl,链接不起作用

我做同样的事情,在这个问题上 ,给我的模板数据,编译它,使它看起来像一个文件 var file = 'data:text/html,' + encodeURIComponent(compiled); 所有看起来不错,模板成功呈现,我得到我的数据,但现在我的标签在头上停止工作,标签像链接或脚本与src属性 在这里,我通过ID MAZ-63171获取pouchdb中的文档,并将该文档提供给我的模板: db.get('MAZ-63171') .then(function(doc) { var compileFn = pug.compileFile('./pugTemplates/index.pug', { pretty: true }); var compiled = compileFn({doc: doc}); console.log(compiled); // console.log(doc); // 'file://' + __dirname + '/pugTemplates/index.pug' var file = 'data:text/html,' + encodeURIComponent(compiled); mainWindow.loadURL(file); }) .catch(function(err) { console.log(err); }); 在index.pug我有这个 doctype html html(lang="en") head title="trucks" link(rel="stylesheet" […]