【问题标题】:Polymer WebComponents and Firefox compatibilityPolymer WebComponents 和 Firefox 兼容性
【发布时间】:2017-08-23 09:38:35
【问题描述】:

我的网络组件是

<dom-module id="my-component">
    <template>
        <h2>YES, IT IS!</h2>
    </template>

    <script>
        Polymer({
            is: 'my-component',
        });
    </script>
</dom-module>

我的 HTML 页面是:

<!DOCTYPE html>
<html>
    <head>
        <script src="webjars/webcomponentsjs/0.7.22/webcomponents.js"></script>
        <link rel="import" href="webjars/polymer-elements-all/0.1.0/polymer/polymer.html">
        <link rel="import" href="my-component.html">    
    </head>

    <body>
        <h1>Is this web component shown?</h1>
        <my-component></my-component>
    </body>
</html>

我正在导入 Polyfills 和 Polymer,它适用于 Google Chrome、Microsoft Edge,甚至适用于 Internet Explorer,但不适用于 Firefox。在 Firefox 中,我的组件没有附加。

我还启用了这两个首选项https://developer.mozilla.org/en-US/docs/Web/Web_Components

请帮忙:)

【问题讨论】:

标签: firefox polymer


【解决方案1】:

您可以尝试将以下行从“HTML 页面”移动到“Web 组件”吗? (确保网址正确。)

<link rel="import" href="webjars/polymer-elements-all/0.1.0/polymer/polymer.html">

【讨论】:

  • 感谢您的回复!还是一样。我什至尝试使用bower_components 并导入&lt;script src="bower_components/webcomponentsjs/webcomponents-lite.js"&gt;&lt;/script&gt; &lt;link rel="import" href="bower_components/polymer/polymer.html"&gt; 路径是正确的,我确定了。
猜你喜欢
  • 1970-01-01
  • 2015-03-26
  • 1970-01-01
  • 2018-12-25
  • 1970-01-01
  • 2015-08-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多