javascript - Firefox 中不显示 polymer 元素

标签 javascript firefox polymer web-component

我编写了在 Chrome 中完美运行的自定义 polymer 元素。但它甚至没有出现在 Firefox 中。我使用 vulcanize 将所有内容连接到一个文件中,甚至是平台和 polymer 。这是我调用 vulcanize 的主要索引文件。

<!DOCTYPE html>
<html>
 <head>
  <script src="bower_components/platform/platform.js"></script>
  <link rel="import" href="bower_components/my_polymer/index.html">
 </head>
</html>

这是我的 polymer 元素索引文件。

<!DOCTYPE html>
 <html>
  <head>
   <link rel="import" href="../polymer/polymer.html">
   <link rel="import" href="my-polymer-element.html">
  </head>
 </html>

最佳答案

您的设置有误。

您不应该导入 index.html,而是在主页中导入您的元素定义。您的主页应如下所示:

<html>
  <head>
   <script src="bower_components/platform/platform.js"></script>
   <link rel="import" href="my-polymer-element.html">
  </head>
  ...
</html>

请注意,polymer.html 在 my-polymer-element.html 定义文件的顶部列为依赖项导入。

参见 http://www.polymer-project.org/docs/start/creatingelements.html#createpolyel还有种子元素:http://www.polymer-project.org/docs/start/reusableelements.html例如。

关于javascript - Firefox 中不显示 polymer 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25749251/

相关文章:

javascript - NPM模块导入时抛出错误

javascript - DOMParser.parseFromString(text ,"text/html") 仅解释前 ~21,500 字节。这是一个错误吗?

polymer - 如何在 Polymer 中创建单例元素

javascript - 浏览器正在取消多个文件下载请求

javascript - 如何在手机间隙使用 iscroll javascript?

Firefox Quantum - 用户代理不正确?

javascript - Polymer:firebase DB 不使用 firebase-element 更新

css - 为什么:host(:hover) not work here?

javascript - 如何通过在 javascript 中单击按钮来更改 css 类?

Firefox 在下载后破坏 pdf