2014-11-06 16 views
1

因此,我決定將Filter從我的PolymerTable中分離出來。我爲我的過濾器創建了一個PolymerElement。我想在FilterElement中顯示錶的一部分,因爲它應該顯示爲帶有表的Bootstrap面板。 http://getbootstrap.com/components/#panels-tables 我不確定我是否使用了內容標籤,或者即使可能,我仍然可以嘗試。 我的代碼看起來有點像這樣:正確使用PolymerElements中的內容標籤

<!-- index.html --> 
<!-- ... --> 
<poly-table></poly-table> 
<!-- ... --> 
<!-- poly-table.html --> 
<polymer-element name="poly-table"> 
<template> 
    /* style */ 
    <div id="table_cont"> 
    <poly-filter> 
    <table class="table"> 
     /* ... stuff inside ... */ 
    </table> 
    </poly-filter> 
    </div> 
</template> 
</polymer-element> 
<!-- poly-filter.html --> 
<polymer-element name="poly-filter"> 
<template> 
    /* style */ 
    <div id="filter_cont" class="panel"> 
    <div class="panel-heading"> 
    Filter 
    </div> 
    <div class="panel-body> 
    <!-- Filter Content here --> 
    </div> 
    <content></content> 
    </div> 
</template> 
</polymer-element> 

我的表將得到渲染之外,我上面的過濾器,而不是過濾器下...

我在PolyFilter中覆蓋parseDeclaration,因此<poly-filter>元素在li中呈現ght DOM。

parseDeclaration(elementElement) { 
    var template = fetchTemplate(elementElement); 
    if (template != null) { 
    lightFromTemplate(template); 
    } 
} 
+0

Bootstrap CSS不能與ShadowDOM一起使用。你沒有應用Bootstrap CSS試過嗎?對我來說,目前看來很好。應該在''元素具有''元素的地方呈現'

'。 – 2014-11-06 10:31:51

+1

沒有Bootstrap它似乎工作。我目前正在使用一種解決方法,以使其與此工作.http://pastebin.com/NKQJbmi8 我不知道它真的是什麼...但讓Bootstrap與我的聚合物元素 – Azael 2014-11-06 10:36:44

+0

我聽說,那裏是一些沒有ShadowDOM的聚合物元素的支持,但從來沒有使用它,它有一些限制,據我記憶,但我不知道任何細節。 – 2014-11-06 10:38:31

回答

0

我想,當你呈現光DOM元素的<content>元素是行不通的。

+1

將元素手動移動到內容標籤中即可完成作業 – Azael 2014-11-06 10:57:54