渲染出一个el-radio列表

实现效果图

img


表单中有两个单选框,选择其中一个,跳出一个单选框的列表,求解答

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .radio-item {
      display: inline-block;
      position: relative;
    }
    ul {
      display: none;
      position: absolute;
      top: 20px;
      left: 0;
      width: 200px;
      border: 1px solid #ddd;
      background-color: #fff;
    }
    #radio2:checked ~ ul {
      display: block;
    }
  </style>
</head>

<body>
  <div class="radio-item">
    <input id="radio1" type="radio" name="type">
    <label for="radio1">空白课题</label>
  </div>
  <div class="radio-item">
    <input id="radio2" type="radio" name="type">
    <label for="radio2">课题库</label>
    <ul>
      <li>
        <label>
          <input type="radio" name="a">
          课题课题
        </label>
      </li>
      <li>
        <label>
          <input type="radio" name="b">
          课题课题
        </label>
      </li>
      <li>
        <label>
          <input type="radio" name="c">
          课题课题
        </label>
      </li>
    </ul>
  </div>
</body>
</html>