AngularJs的UI組件ui-Bootstrap分享(六)——Tabs

來源:互聯網
上載者:User

標籤:url   meta   cal   xmlns   timeout   控制項   並且   function   time   

原文地址:http://www.cnblogs.com/pilixiami/p/5635137.html

tabs控制項使用uib-tabset指令和uib-tab指令,效果是這樣的:

 

<!DOCTYPE html><html ng-app="ui.bootstrap.demo" xmlns="http://www.w3.org/1999/xhtml"><head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <link href="/Content/bootstrap.css" rel="stylesheet" />    <title></title>    <script src="/Scripts/angular.js"></script>    <script src="/Scripts/ui-bootstrap-tpls-1.3.2.js"></script>    <script>        angular.module(‘ui.bootstrap.demo‘, [‘ui.bootstrap‘]).controller(‘TabsDemoCtrl‘, function ($scope, $window) {            $scope.tabs = [              { title: ‘標籤頁a‘, content: ‘標籤頁a的內容‘ },              { title: ‘標籤頁b‘, content: ‘標籤頁b的內容‘, disabled: true }            ];            $scope.alertMe = function () {                setTimeout(function () {                    $window.alert(‘clicked!‘);                });            };        });    </script></head><body>    <div ng-controller="TabsDemoCtrl">        <uib-tabset active="active" type="tabs">            <uib-tab index="0" heading="標籤頁1">內容1</uib-tab>            <uib-tab index="$index + 1" ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disable="tab.disabled">                {{tab.content}}            </uib-tab>            <uib-tab index="3" select="alertMe()">                <uib-tab-heading>                    <i class="glyphicon glyphicon-bell"></i> Alert!                </uib-tab-heading>                內容部分            </uib-tab>        </uib-tabset>    </div></body></html>

 

uib-tabset可使用的屬性有:

屬性名稱

預設值

備忘

active

第一個標籤頁的索引

當前啟用的標籤頁的索引

justified

false

是否將各個標籤頁等寬分布在父容器中

template-url

uib/template/tabs/tabset.html

 

type

tabs

標籤頁的類型。可設定為tabs或pills

vertical

false

是否垂直顯示

uib-tab可使用的屬性有:

屬性名稱

預設值

備忘

classes

 

可添加用空格分隔的類名

deselect

 

標籤頁面板取消選中時(啟用其他標籤頁)觸發的函數。支援傳入事件對象參數$event,並且可以用$event.preventDefault()取消操作。

disable

false

是否禁用

heading

 

標籤網頁標題的文本

index

 

標籤頁的索引。每個索引必須唯一

select

 

標籤頁選中時觸發的函數。支援傳入事件對象參數$event,並且可以用$event.preventDefault()取消操作。

template-url

uib/template/tabs/tab.html

 

 如果面板的標題是簡單的文本,使用heading屬性就足夠了。如果是複雜的內容,比如有表徵圖,那麼可以使用uib-tab-heading。這一點和According控制項是一樣的。

 

AngularJs的UI組件ui-Bootstrap分享(六)——Tabs

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.