使用Polymer 2.0混合组件

时间:2018-09-25 18:34:22

标签: polymer polymer-2.x

我致力于从Polymer 1.0到Polymer 2.0的迁移。

我将所有组件重写为Polymer 2.0混合模式。

但是当我在Polymer 2.0下使用Polymer 2.0混合组件时,我收到下一个错误:

polymer-micro.html:449 Uncaught DOMException: Failed to execute 'registerElement' on 'Document': Registration failed for type 'dom-module'. A type with that name is already registered.

是否可以在聚合物2.0下使用聚合物2.0混合组件?

如何避免此错误?

具有混合模式的组件的简单示例:

<link rel="import" href="../../bower_components-1.x/iron-icon/iron-icon.html">

<dom-module id="hybrid-component">
    <template>
        <style>            
        </style>

        <p>test></p>
    </template>

    <script>
        Polymer({
            is: 'hybrid-component',

            properties: {

            }            
        });
    </script>
</dom-module>

0 个答案:

没有答案