亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

HTML 導入在 Electron 應用程序中不起作用

HTML 導入在 Electron 應用程序中不起作用

達令說 2023-08-05 19:23:43
我正在嘗試使用 Electron 構建桌面應用程序。我在導入 HTML 模板時遇到問題。代碼<link rel="import" href="fileLocation/file.html">文件.html<template>  <div>Template html content </div></template>//script in index.html file<script>   const links = document.querySelectorAll('link[rel="import"]')   Array.prototype.forEach.call(links, (link) => {      let template = link.import.querySelector('template')      //error: cannot read property "querySelectorAll" of undefined      //I tried to console.log(link)      //it gives output: <link rel="import" href="fileLocation/file.html">      //but in electron demo app it is giving actual template.   })</script>//running below code in my index.html to test html import compatibilityconsole.log(    "Native HTML Imports?", 'import' in document.createElement('link'),    "Native Custom Elements v0?", 'registerElement' in document,    "Native Shadow DOM v0?", 'createShadowRoot' in document.createElement('div'));//output: Native HTML Imports? false Native Custom Elements v0? false Native Shadow DOM v0? false//running the same code in Electron API demo app (example app given on electron github repo)console.log(    "Native HTML Imports?", 'import' in document.createElement('link'),    "Native Custom Elements v0?", 'registerElement' in document,    "Native Shadow DOM v0?", 'createShadowRoot' in document.createElement('div'));//output: Native HTML Imports? true Native Custom Elements v0? true Native Shadow DOM v0? true請告訴我如何配置我的應用程序,以便我的結果與 Electron 演示應用程序匹配。
查看完整描述

1 回答

?
慕蓋茨4494581

TA貢獻1850條經驗 獲得超11個贊

我遇到了同樣的問題,似乎與新版本的電子(10.1.5)有關。

恢復到版本 7.2.4 對我有用


查看完整回答
反對 回復 2023-08-05
  • 1 回答
  • 0 關注
  • 188 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號