【问题标题】:Polymer 1.0 does not work with Firefox Stable or Developer EditionPolymer 1.0 不适用于 Firefox 稳定版或开发版
【发布时间】:2015-08-17 22:53:45
【问题描述】:

加载 JS 文件“webcomponentsjs/webcomponents-lite.min.js”有助于聚合物在 chrome 上工作,但不能在 firefox 上工作。

我尝试将以下内容添加到我的 application.js 文件 (rails)。

// = require webcomponentsjs/webcomponents

也试过

// = require webcomponentsjs/webcomponents.min

也试过

// = require webcomponentsjs/webcomponents-lite.min

结合以下JS文件使用。

//= require jquery/dist/jquery.min
//= require select2/select2
//= require angular/angular.min
//= require fastclick/lib/fastclick
//= require magnific-popup/dist/jquery.magnific-popup.min

我正在从 bower 安装所有软件包并在 rails 4 中使用。

Chrome 在没有 webcomponentsjs 的情况下也能正常工作。但是当我添加 webcomponentsjs 时,chrome 停止显示聚合物元素,而 firefox 除了不断向我的本地服务器发送请求外,也不显示元素。

知道如何让 1.0 在 Firefox 上运行吗? 0.5 工作得很好。

特别是这段代码不会渲染:

<paper-input id="bodyinput" name="thetext" type="text" class="searchbar" placeholder="Enter a search term here..." autofocus> </paper-input>

我确保执行以下 HTML 导入:

<!-- polymer imports -->
<link rel="import" href="/assets/polymer/polymer.html">
<link rel="import" href="/assets/paper-input/paper-input.html">

【问题讨论】:

  • 您到底遇到了什么问题?你有任何代码示例或产生任何错误吗?
  • 这些是 Firefox 控制台中的警告-"[paper-dialog::_flattenBehaviorsList]:" "behavior is null, check for missing or 404 import""WARNING: Tried to load angular more than once."
  • 具体来说,我遇到了纸张输入问题(这是我的应用程序中使用的元素之一)
  • 您在使用这里的新 v1.0 组件吗?你在使用 angularjs 吗?我在我的应用程序中添加了一个纸质对话框,并在 Firefox v38 中进行了尝试,它按预期工作。
  • 是的。也使用 v1.0 和 angularjs。

标签: firefox ruby-on-rails-4 polymer web-component


【解决方案1】:

首先,如果您使用的是 Polymer 0.8+,则必须导入 webcomponents-lite.js 或 webcomponents-lite.min.js。在浏览器中签入后,它是否在加载页面时收到此文件。不要忘记检查接收到的 webcomponents 文件中的数据,它可以是空的。

如果您使用一些自动化工具来构建项目,例如 uglify 或其他将 js 文件转换为 min.js 文件或对导入的 js 文件进行一些优化的工具,则可能会出现空 webcomponents-lite.js 文件的问题。如果存在,只需从该任务中排除 webcomponents-lite.js 文件。

【讨论】:

    猜你喜欢
    • 2011-04-29
    • 1970-01-01
    • 2017-04-09
    • 2016-12-17
    • 1970-01-01
    • 1970-01-01
    • 2015-11-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多