1

我正在尝试插入一个导航选项卡,当用户单击 Pane5 时,该导航选项卡将显示在主选项卡下方,但是当我单击子元素(Pane01 或 Pane02)时,出现应用路由器错误。这是因为嵌套引导而发生的吗

在此处输入图像描述 以下是页面中 HTML 结构的示例:

<template>

      <div>

        <div class="row">
          <div class="col-lg-12">
            <div class="row">
              <div class="col-lg-6">
                <h3 class=""><span t="asset_details"></span>SomeElement</h3>
              </div>
              <div class="col-lg-6">
                <a class="pull-right"><i class="fa fa-window-close fa-2x"></i></a>
              </div>
            </div>
            <div class="row">
              <ul class="nav nav-pills"> 
                <li><a data-toggle="tab" href="#pane1"><span>Details</span></a></li>
                <li><a data-toggle="tab" href="#pane2"><span>Details</span></a></li>
                <li><a data-toggle="tab" href="#pane3"><span>Other</span></a></li>
                <li><a data-toggle="tab" href="#pane4"><span>Element</span></a></li>
                <li><a data-toggle="tab" href="#pane6"><span>Element</span></a></li>
                <li><a data-toggle="tab" href="#pane5"><span>Element</span></a></li>
              </ul>
              <div class="tab-content">

                <div class="tab-pane active" id="pane1">
                  <div class="col-lg-12">
                    <div class="row">
                      <div class="col-lg-4">
                      </div>

                      <div class="col-lg-8">
                        <div class="row">
                          <div class="col-lg-6">
                            <compose>
                            </compose>
                          </div>
                          <div class="col-lg-6">
                            <compose></compose>
                          </div>
                        </div>
                        <div class="row">
                          <div class="col-lg-12">
                            <compose></compose>
                          </div>

                        </div>
                      </div>
                    </div>
                  </div>

                </div>

                <div class="tab-pane" id="pane2">
                  <div class="col-lg-12">
                    <div class="row">
                      <div class="col-lg-12">
                        <!--<commercial-line device-id.bind="deviceId"></commercial-line>-->
                        <compose></compose>
                      </div>

                    </div>

                  </div>
                </div>
                <div class="tab-pane" id="pane3">
                  <div class="col-lg-12">
                    <div class="row">
                      <div class="col-lg-6">
                        <compose></compose>
                      </div>
                      <div class="col-lg-6">
                        <compose></compose>
                      </div>
                    </div>
                  </div>
                </div>

                <div class="tab-pane" id="pane4">
                  <div class="col-lg-12">
                    <div class="row">
                      <div class="col-lg-12">
                        <compose></compose>
                      </div>

                    </div>
                  </div>
                </div>

                <div class="tab-pane" id="pane5">
                  <div class="col-lg-12">
                    <div class="row">
                      <div class="col-lg-12">

                        <ul class="nav nav-pills">
                          <li class="active"><a href="#pane01"><span>History</span></a></li>
                          <li if.bind="!history"><a href="#pane02"><span>Param</span></a></li>
                        </ul>

                <div class="tab-content">
                  <div class="tab-pane active" id="pane01">
                      <div class="col-lg-12">
                          <div class="row">
                              <table class="table table-hover table-condensed" ref="theTable">
                                  <thead>
                                      <th>
                                        <span>Afla</span>
                                      </th>
                                      <th class="col-lg-2">
                                        <span>Beta</span>
                                      </th>
                                      <th>
                                        <span>Gama</span>
                                      </th>
                                      <th>
                                        <span>Gama</span>
                                      </th>
                                      <th>

                                      </th>
                                    </thead>
                                    <tbody>
                                      <tr repeat.for="element of Array">
                                        <td>
                                          <span>${element.first}</span>
                                        </td>
                                        <td class="col-lg-2">
                                          <span >${element.second}</span>                            
                                        </td>
                                        <td>
                                          <span>${element.third}</span>
                                        </td>
                                        <td>
                                          <span>${element.fourth}</span>
                                        </td>
                                        <td >      
                                          <span>${element.fifth}</span>
                                        </td>
                                      </tr>
                                    </tbody>
                              </table>
                          </div>
                      </div>
                  </div>


                  <div class="tab-pane" id="pane02">
                      <div class="col-lg-12">
                          <div class="row"> 
                              <div class="col-lg-12">
                                  <table class="table table-hover table-condensed">
                                      <thead>
                                          <th>
                                            <span>Alfa</span>
                                          </th>
                                          <th>
                                            <span>Beta</span>
                                          </th>
                                          <th>
                                            <span>Gama</span>
                                          </th>
                                          <th>
                                            <span>Gama</span>
                                          </th>
                                          <th>
                                            <span>Example</span>
                                          </th>
                                          <th>
                                            <span>Inte</span>
                                          </th>
                                        </thead>
                                        <tbody>
                                          <tr repeat.for="item of array">
                                            <td>
                                              <span date-time>${item.date}</span>
                                            </td>
                                            <div class="divider"></div>
                                            <td>
                                              <span date-time>${item.date2}</span>
                                            </td>
                                            <td>
                                              <span>${item.user}</span>
                                            </td>
                                            <td>
                                              <span>${item.array1}</span>
                                            </td>
                                            <td>
                                              <span>${item.array2}</span>
                                            </td>

                                        </tbody>
                                  </table>
                              </div>
                          </div>
                      </div>
                  </div>
              </div>
                      </div>
                    </div>
                  </div>

                </div>
                <div class="tab-pane" id="pane6">
                  <div class="col-lg-12">
                    <div class="row">
                      <div class="col-lg-12">
                        <compose view-model="view-model">
                        </compose>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>

            </div>
            </div>
            </div>
    </template>
4

2 回答 2

2

为您的标签添加一个router-ignore属性。a这样 aurelia 就不会在单击您的链接时激活路由逻辑。

有关该主题的更多信息,请参见文档:https ://aurelia.io/docs/routing/handling-links#basic-concept

于 2020-03-12T07:54:07.553 回答
0

Bootstrap 中的替代方法hrefdata-target. 所以如果你想做:

<a href="#panel-1">

那么你可以改为:

<a data-target="#panel-1">

它们是相同的。好处data-target是它可以支持多个选择器

于 2020-03-13T02:01:57.347 回答