neverland 371f6c1c7f [new feature] Toast support position prop (#244)
* [bugfix] Checkbox border render error in weixin browser

* [bugfix] TreeSelect dependency path error

* [bugfix] Swipe should clear autoplay timer when destroyed

* [bugfix] Optimize component dependency analyze when build style entry

* merge

* update yarn.lock

* update README.md

* update README.md

* update README.md

* update README.md

* update README.md

* [Doc] add more badges in README.md

* update README.md

* [bugfix] Address & Contact list style

* fix: contact test cases

* [bugfix] popup style missing when build style entry

* [bugfix] Search: onSearch event arguments missing

* [Doc] add demo pages

* update zan-doc@0.3.7

* fix: build entry error

* [Doc] add goods demo

* [bugfix] button primary background color

* [Doc] update doc detail

* [new feature] Coupon add 'showExchangeBar' prop && add empty style

* [new feature] Toast support `position` prop

* [new feature] Tabbar add 'info' prop
2017-10-24 22:41:06 -05:00

2.1 KiB

Tabbar

Install

import { Tabbar, TabbarItem } from 'vant';

Vue.component(Tabbar.name, Tabbar);
Vue.component(TabbarItem.name, TabbarItem);

Usage

Basic Usage

:::demo Basic Usage

<van-tabbar v-model="active">
  <van-tabbar-item icon="shop">Tab</van-tabbar-item>
  <van-tabbar-item icon="chat" dot>Tab</van-tabbar-item>
  <van-tabbar-item icon="records" info="5">Tab</van-tabbar-item>
  <van-tabbar-item icon="gold-coin" info="20">Tab</van-tabbar-item>
</van-tabbar>
export default {
  data() {
    return {
      active: 0
    }
  }
}

:::

Custom icon

Use icon slot to custom icon

:::demo Custom icon

<van-tabbar v-model="active2">
  <van-tabbar-item icon="shop">
    <span>Custom</span>
    <img slot="icon" :src="active2 === 0 ? icon.active : icon.normal" />
  </van-tabbar-item>
  <van-tabbar-item icon="chat">Tab</van-tabbar-item>
  <van-tabbar-item icon="records">Tab</van-tabbar-item>
</van-tabbar>
export default {
  data() {
    return {
      active2: 0,
      icon: {
        normal: '//img.yzcdn.cn/1.png',
        active: '//img.yzcdn.cn/2.png'
      }
    }
  }
}

:::

Tabbar API

Attribute Description Type Default Accepted Values
v-model Index of current tab Number - -

Tabbar Event

Event Description Attribute
change Triggered when change active tab active: index of current tab

TabbarItem API

Attribute Description Type Default Accepted Values
icon Icon name String - Names from Icon Component
dot Whether to show red dot Boolean - -
info Info message String - -