使用JS / Jquery选择Office Fabric数据透视表选项卡

时间:2018-04-08 14:07:57

标签: javascript jquery office-fabric

我在Office Fabric中使用了数据透视控件。它是标准的JS库,而不是React / Angular库。如何选择带JS / JQuery的选项卡?

我在页面加载时调用API,并且依赖于我想要显示第一个选项卡或第三个选项卡的结果。



<div class="ms-Pivot">
  <ul class="ms-Pivot-links">
    <li class="ms-Pivot-link is-selected" data-content="files" title="My files" tabindex="1">
      My files
    </li>
    <li class="ms-Pivot-link " data-content="recent" title="Recent" tabindex="1">
      Recent
    </li>
    <li class="ms-Pivot-link " data-content="shared" title="Shared with me" tabindex="1">
      Shared with me
    </li>
    <li class="ms-Pivot-link" tabindex="1">
      <i class="ms-Pivot-ellipsis ms-Icon ms-Icon--More"></i>
    </li>
  </ul>
  <div class="ms-Pivot-content" data-content="files">
    This is the my files tab.
  </div>
  <div class="ms-Pivot-content" data-content="recent">
    This is the recent tab.
  </div>
  <div class="ms-Pivot-content" data-content="shared">
    This is the shared with me tab.
  </div>
</div>


<script type="text/javascript">
  var PivotElements = document.querySelectorAll(".ms-Pivot");
  for (var i = 0; i < PivotElements.length; i++) {
    new fabric['Pivot'](PivotElements[i]);
  }
</script>
&#13;
&#13;
&#13;

https://dev.office.com/fabric-js/Components/Pivot/Pivot.html

0 个答案:

没有答案