2016-08-20 47 views

回答

1

我懷疑其不可能的,因爲對於數據結合工作,所述元件(或與所述的textContent元件)需要已經從聚合物,這當然headtitle不是繼承。

你可以做的是創建一個放置在主體中的元素(<proxy-title>?),並且在觀察者中以編程方式在dom中定位標題元素並寫入它擁有的標題屬性。

喜歡的東西

<dom-module id="proxy-title"> 
    <template> 
    <style> 
     :host { 
     display:none; 
     }; 
    </style> 
    </template> 
    <script> 
    Polymer({ 
     is: 'proxy-title', 
     properties: { 
     title: { 
      type: String, 
      value: '', 
      observer: '_titleChanged' 
     } 
     }, 
     _titleChanged: function(title) { 
     document.title = this.title; 
     } 

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

你會使用它,像這樣

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<title></title> 
<!-- other head stuff --> 
</head> 
<body> 
    <proxy-title title="[[someTitle]]"></proxy-title> 

    <!-- ... other stuff here --> 

</body> 
</html> 
+0

謝謝akc42。將測試這一次回家! – willsquire

相關問題