angular4 bootstrap多下拉列表无法正常工作

时间:2017-07-18 17:36:09

标签: angular drop-down-menu

<div [ngClass]="{'dropdown': true, 'open': isDropdownOpen}">
  <button id="dLabel" role="button" (click)="isDropdownOpen = !isDropdownOpen" data-toggle="dropdown" class="btn btn-dropdown">
    {{selectedFieldType ? selectedFieldType: item.subType}} <span class="caret"></span>
  </button>
  <ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
    <li class="dropdown-submenu">
      <a tabindex="-1">Text</a>
      <ul class="dropdown-menu" style="width: 200px">
        <li>Text</li>
        <li>Number</li>
      </ul>
    </li>
    <li class="dropdown-submenu">
      <a tabindex="-1">Radio Button Group</a>
      <ul class="dropdown-menu">
        <li>Blank Template</li>
        <!--<li>Gender Selection</li>
      </ul>
    </li>
  </ul>
</div>

我之前在Angular2上实现了多次下拉,当我最近将它迁移到angular4时它工作了吗?

这是我使用

的css代码
.dropdown{
  display: inline;
}

.dropdown{
  display: inline;
}
.dropdown-submenu {
  position: relative;
  width: 200px;
}

.dropdown-submenu>.dropdown-menu {
  top: 0;
  left: 100%;
  margin-top: -6px;
  margin-left: -1px;
  -webkit-border-radius: 0 6px 6px 6px;
  -moz-border-radius: 0 6px 6px;
  border-radius: 0 6px 6px 6px;
}

.dropdown-submenu:hover>.dropdown-menu {
  display: block;
}

.dropdown-submenu>a:after {
  display: block;
  content: " ";
  float: right;
  width: 0;
  height: 0;
  border-color: transparent;
  border-style: solid;
  border-width: 5px 0 5px 5px;
  border-left-color: #ccc;
  margin-top: 5px;
  margin-right: -10px;
}

.dropdown-submenu:hover>a:after {
  border-left-color: #fff;
}

.dropdown-submenu.pull-left {
  float: none;
}

.dropdown-submenu.pull-left>.dropdown-menu {
  left: -100%;
  margin-left: 10px;
  -webkit-border-radius: 6px 0 6px 6px;
  -moz-border-radius: 6px 0 6px 6px;
  border-radius: 6px 0 6px 6px;
}

单击

时未显示多个下拉列表

plunker https://plnkr.co/edit/KInH93J0av7QdNR1b5ox?p=preview

0 个答案:

没有答案