【问题标题】:Installing bootstrap-web-components to polymer将 bootstrap-web-components 安装到聚合物
【发布时间】:2015-01-26 13:19:43
【问题描述】:

我在玩 polymerjs。

目标

我想使用 polymerjs 创建一个自定义元素,并将引导模式对话框封装在这个自定义元素中。干净的解决方案似乎是使用mike costello's bootstrap-web-components

boostrap-modal.html

<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/bootstrap-web-components/dist/imports.html">

<polymer-element name="bootstrap-modal" attributes="script css">
    <template>
        <bs-modal title="Title" show="false">
            Dialog Contents
        </bs-modal>
    </template>

    <script>
    </script>
</polymer-element>

问题

我使用 bower 来安装库。我的项目有根 Polymer,并且在此文件夹中包含 index.html 文件、bower.json 文件和文件夹 bower_components。我的 bootstrap 和 bootstrap-web-components 文件夹位于 bower_components 文件夹中。我只在我的自定义元素中导入 bootstrap-web-components imports.html 文件。

运行时,我在 bootstrap-web-components.js 的第 13 行收到 Uncaught TypeError: undefined is not a function

感谢您的帮助!

【问题讨论】:

    标签: twitter-bootstrap polymer bower-install


    【解决方案1】:

    在 2013 年创建 repo 时,使用的聚合物 register() 已更改为 registerElement()。我已经相应地更新了 repo 和 Bower 包。

    首先要导入,请确保您的网站现在在http://webcomponents.org 有 HTMLImports 和 CustomElements 填充物

    那你可以&lt;link rel="import" href="dist/imports.html"&gt;

    查看http://mikecostello.github.io/bootstrap-web-components的工作示例查看源代码

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-02
      • 2014-09-19
      • 1970-01-01
      相关资源
      最近更新 更多