提问者:小点点

链接列表组内带有下拉菜单的按钮


我一直试图将一个下拉按钮放入一个链接列表组项中,但是每当我单击链接组项内部的按钮时,它都不会显示下拉菜单。

我在其他问题中看到的唯一解决方案是将更改为

  • ,但我需要它是一个链表。

    我如何保持它的链接,因为它引用的是标签内容,但也有可能有一个按钮,显示一个下拉菜单在它?

    这就是我目前所拥有的:

    null

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" />
    
    <div class="list-group rounded-0" id="list-tab" role="tablist">
      <a class="list-group-item list-group-item-action active" id="list-home-list" data-toggle="list" href="#list-home" role="tab" aria-controls="home">
        <div class="d-flex justify-content-between text-nowrap">
          <h5 class="mb-1">Text</h5>
          <small>2 days ago</small>
        </div>
        <p class="mb-1 mr-5">Text</p>
        <div class="d-flex justify-content-between text-nowrap">
          <small>Text</small>
          
          <div class="dropdown">
            <button class="btn btn-warning btn-sm" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-expanded="false">B</button>
            <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
              <li><a class="dropdown-item" href="#">A</a></li>
              <li><a class="dropdown-item" href="#">B</a></li>
              <li><a class="dropdown-item" href="#">C</a></li>
              <li><a class="dropdown-item" href="#">D</a></li>
              <li><a class="dropdown-item" href="#">E</a></li>
            </ul>
          </div>
          
        </div>
      </a>
      <a class="list-group-item list-group-item-action" id="list-home-list" data-toggle="list" href="#list-home" role="tab" aria-controls="home">
        <div class="d-flex justify-content-between text-nowrap">
          <h5 class="mb-1">Text</h5>
          <small>3 days ago</small>
        </div>
        <p class="mb-1 mr-5">Text</p>
        <div class="d-flex justify-content-between text-nowrap">
          <small>Text</small>
          <span class="btn btn-danger risk btn-sm">?</span>
        </div>
      </a>
    </div>

    null


  • 共1个答案

    匿名用户

    更改为