prototype.registerCallback is not a function in Polymer

感情迁移 提交于 2019-12-12 11:20:19

问题


I've try to use core-icon and layout element. When I import core-icons.html, there's some error..

Uncaught TypeError: prototype.registerCallback is not a function

and there is any element display on the page.

What should I do to fix it. - Using Polymer 0.9 and Elements (0.5)


回答1:


Core Elements are not compatible with Polymer 0.9. Use iron-elements instead.




回答2:


So I got the same error when I started using version 1.0 of Polymer. Apparently I was using old syntax.

version 0.5 syntax:

Polymer('shape-menu',{
  shapes: ['a'],
  ...

version 1.0 syntax:

Polymer({
  is:"shape-menu",
  shapes: ['a'],
  ...



回答3:


During upgrade from very old Polymer to Polymer v1.7.0 I received this same error. To fix I noticed that I had accidentally migrated a function into the "properties" section rather than as a sibling to the "properties".

Broken:

<script>
  Polymer({
    is: 'my-comp',
    properties: {
      myprop: 'my value',
      myfunction: function(){
         ...
      },
    },
});
</script>

Fixed:

<script>
  Polymer({
    is: 'my-comp',
    properties: {
      myprop: 'my value',
    },
    myfunction: function(){
         ...
    },
});
</script>

Even though this question is marked as answered I thought this alternate fix might be useful to someone having this error for the same reason I did.



来源:https://stackoverflow.com/questions/30431606/prototype-registercallback-is-not-a-function-in-polymer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!