我编写了在 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/