3

我正在玩聚合物。

目标

我想使用封装在此自定义元素中的带有引导模式对话框的polymerjs创建自定义元素。干净的解决方案似乎是使用mike costello 的 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>

问题

我用凉亭安装库。我的项目有根 Polymer 并且在这个文件夹中驻留index.html文件、bower.json文件和一个文件夹bower_components。我的bootstrapbootstrap-web-components文件夹位于 bower_components 文件夹中。我只在我的自定义元素中导入 bootstrap-web-components imports.html 文件。

运行时,我得到一个Uncaught TypeError: undefined is not a function on the 13th line of bootstrap-web-components.js

感谢您的帮助!

4

1 回答 1

4

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

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

那么你就可以<link rel="import" href="dist/imports.html">

有关http://mikecostello.github.io/bootstrap-web-components的工作示例视图源

于 2015-04-16T20:13:11.140 回答