2016-08-22 52 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即可。