2016-08-22 57 views
0

我想ID为“测试-COMP”为路径“/ PATH1”导入Web组件:应用路由器和网络组件的回调函数

<app-route path="/path1" import="test-component.html" template="test-comp"></app-route> 

Web组件的代码是如下:

<dom-module id="test-comp"> 
    <template> 
     <div>Hello world</div> 
    </template> 
</dom-module> 

<script> 
     Polymer({ 
      is: 'test-comp', 
      attached: function() { 
       console.log("is attached"); 
      }, 
     }); 
</script> 

但是,它永远不会输入attached回调。有任何想法吗?非常感谢。

回答

0

解决:只需将template属性替换为id即可。