标签拦 TabBar

基本用法

  1. <za-cell title="隐藏 | 展示">
  2. <za-button slot="description" ghost @click="toggle">隐藏</za-button>
  3. </za-cell>
  4. <za-tab-bar :visible="visible" :defaultActiveKey="1" @change="handleChange">
  5. <za-tab-bar-item :item-key="1" title="首页">
  6. <za-icon slot="icon" tag="symbol" type="home" class="icon"></za-icon>
  7. <za-icon slot="activeIcon" tag="symbol" theme="primary" type="home" class="icon"></za-icon>
  8. </za-tab-bar-item>
  9. <za-tab-bar-item :item-key="2" title="保险">
  10. <za-badge slot="icon" sup shape="circle" text="3" @click="handleClick">
  11. <za-icon tag="symbol" type="insurance" class="icon"></za-icon>
  12. </za-badge>
  13. <za-badge slot="activeIcon" sup shape="circle" text="3" @click="handleClick">
  14. <za-icon tag="symbol" theme="primary" type="insurance" class="icon"></za-icon>
  15. </za-badge>
  16. </za-tab-bar-item>
  17. <za-tab-bar-item :item-key="3" title="用户">
  18. <za-icon slot="icon" tag="symbol" type="user" class="icon"></za-icon>
  19. <za-icon slot="activeIcon" tag="symbol" theme="primary" type="user" class="icon"></za-icon>
  20. </za-tab-bar-item>
  21. </za-tab-bar>

Vue Script

  1. <script name="vue">
  2. export default {
  3. data() {
  4. return {
  5. activeKey: 1,
  6. visible: true,
  7. }
  8. },
  9. methods: {
  10. toggle() {
  11. this.visible = !this.visible;
  12. },
  13. handleChange(value) {
  14. alert(value);
  15. }
  16. },
  17. };
  18. </script>

API

TabBar

属性类型默认值说明
v-modelnumber | string-当前选中项
defaultActiveKeynumber | string-初始选中项, 默认第一个选中
visiblebooleantrue是否显示

TabBarItem

属性类型默认值说明
itemKeynumber | string-唯一标识,对应activeKey
title-标题文字
iconslot-图标
activeIconslot-选中时图标

TabBar Events

事件名称说明回调参数
change点击tabbarItem触发的选中事件值变化时触发的回调函数

TabBar 标签栏 - 图1