2016-05-18 46 views
1

我有一個非常基本的實現紙質菜單的嘗試。然而,呈現的HTML是不正確的,並打破了交互。當點擊一個菜單項時,整個列表消失。我已經確定這是因爲紙張項目元素不在紙張菜單元素內的非常關鍵的div內呈現。聚合物紙菜單HTML在瀏覽器中不能正確顯示

我component.html看起來是這樣的:

<div> 
    <paper-menu selected="0"> 
     <paper-item>Location 1</paper-item> 
     <paper-item>Location 2</paper-item> 
    </paper-menu> 
</div> 

然而,什麼被渲染的是這樣的:

<div> 
    <paper-menu role="menu" tabindex="0" selected="0" class="x-scope paper-menu-0"> 
     <div class="selectable-content style-scope paper-menu"> 
     </div> 
     <paper-item role="option" tabindex="0" aria-disabled="false" class="x-scope paper-item-0">Location 1</paper-item> 
     <paper-item role="option" tabindex="0" aria-disabled="false" class="x-scope paper-item-0">Location 2</paper-item> 
    </paper-menu> 
</div> 

如果我操縱在瀏覽器中呈現的HTML這樣的密切div標籤正確包裝紙項目元素,交互工作。

我在做什麼錯?

在我的index.html我:

<script src="lib/webcomponentsjs/webcomponents-lite.js"></script> 
<link rel="import" href="lib/paper-button/paper-button.html" /> 
<link rel="import" href="lib/paper-input/paper-input.html" /> 
<link rel="import" href="lib/paper-item/paper-item.html" /> 
<link rel="import" href="lib/paper-menu/paper-menu.html" /> 
<link rel="import" href="lib/paper-listbox/paper-listbox.html" /> 
<link rel="import" href="lib/paper-toggle-button/paper-toggle-button.html" /> 
<link rel="import" href="lib/paper-progress/paper-progress.html" /> 
<link rel="import" href="lib/paper-dropdown-menu/paper-dropdown-menu.html" /> 

在我bower.json我引用下面的版本

{ 
    "name": "permit-manager-app", 
    "private": true, 
    "dependencies": { 
    "polymer": "^1.4.0", 
    "webcomponentsjs": "^0.7.22", 
    "paper-button": "^1.0.11", 
    "paper-input": "^1.1.10", 
    "paper-progress": "^1.0.9", 
    "paper-dropdown-menu": "1.2.1", 
    "paper-menu": "1.2.2", 
    "paper-item": "1.2.1", 
    "paper-listbox": "1.1.2", 
    "paper-toggle-button": "^1.1.2" 

    } 
} 

這是Angular2測試17

+0

BUMP:我通過明確包裝與預期div標籤紙項目列表砍死的問題。結果是呈現的html現在有2個div元素。 1個空的什麼都不做,第二個提供必要的容器,然後組件按預期工作。仍在尋找對源頭問題和解決方案的解釋。 – Jessel

回答

相關問題