Angular Js弹出菜单

Angular Js Flyout menu

本文关键字:菜单 Js Angular      更新时间:2023-09-26

这是我在angular js中的第一个项目,我正试图在弹出菜单中显示一个树。我找到了这个下拉菜单示例http://angular-ui-tree.github.io/website/tree.html我想把它改成弹出菜单。

因此,在给定的示例中,子节点显示在父节点下方。但是,我希望子节点显示在父节点的右侧。

有没有我遗漏的例子?知道菜单内容将动态加载,最好的方法是什么?

这里有一个使用Angular的简单弹出菜单。该示例中的内容不是动态的,但可以调整数据模型,以便动态加载菜单的内容。

http://codepen.io/jonnycincocinco/pen/dpovAB

.tree {
  position: relative;
  display: block;
  width: 150px; }
  .tree .currentItem {
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    width: 150px;
    padding-left: 10px;
    cursor: pointer;
    min-height: 30px;
    line-height: 30px;
    border: 1px solid #d8d8d8;
    border-radius: 3px; }
    .tree .currentItem:hover {
      background-color: #f9f9f9; }
    .tree .currentItem > .arrow {
      top: 13px; }
    .tree .currentItem > ul {
      left: -1px;
      top: -5px; }
  .tree li a {
    display: block;
    position: relative;
    min-height: 30px;
    line-height: 30px;
    padding-left: 10px;
    padding-right: 20px;
    cursor: pointer;
    color: #7f7f7f;
    text-decoration: none; }
  .tree .arrow {
    position: absolute;
    top: 10px;
    right: 10px; }
    .tree .arrow.right {
      border-left-color: #7f7f7f; }
  .tree li a.active {
    background: #4285f4;
    color: white; }
    .tree li a.active > .arrow.right {
      border-left-color: white; }
  .tree ul {
    box-sizing: border-box;
    width: 150px;
    padding: 10px 0;
    top: -11px;
    left: 100%;
    display: none;
    position: absolute;
    background: white;
    border-radius: 3px;
    border: 1px solid #d8d8d8;
    box-shadow: 0 5px 10px 0 rgba(0, 0, 0, 0.2); }
  .tree .active > ul {
    display: block; }