1. 首页
  2. 文档
  3. WeUI.js文档
  4. 导航栏(tab)

导航栏(tab)

导航栏

tab(selector, [options])

Kind: global function

Param Type Default Description
selector string tab的selector
[options] object 配置项
[options.defaultIndex] number 0 初始展示的index
[options.onChange] function 点击tab时,返回对应的index

Example

html

<div class="weui-tab" id="tab">
    <div class="weui-navbar">
        <div class="weui-navbar__item">反馈</div>
        <div class="weui-navbar__item">表单</div>
        <div class="weui-navbar__item">上传</div>
        <div class="weui-navbar__item">其它</div>
    </div>
    <div class="weui-tab__panel">
        <div class="weui-tab__content">反馈页</div>
        <div class="weui-tab__content">表单页</div>
        <div class="weui-tab__content">上传页</div>
        <div class="weui-tab__content">其它页</div>
    </div>
</div>

js

weui.tab('#tab',{
    defaultIndex: 0,
    onChange: function(index){
        console.log(index);
    }
});


发表评论

电子邮件地址不会被公开。 必填项已用*标注