## Tabbar 标签栏
### 使用指南
在 app.json 或 index.json 中引入组件
```json
"usingComponents": {
"van-tabbar": "/packages/tabbar/index",
"van-tabbar-item": "/packages/tabbar-item/index"
}
```
### 代码演示
#### 基础用法
```html
标签
标签
标签
标签
```
```javascript
Page({
data: {
active: 0
},
// event.detail 的值为当前选中项的索引
onChange(event) {
console.log(event.detail);
}
});
```
#### 自定义图标
可以通过 slot 自定义图标,其中 icon slot 代表未选中状态下的图标,icon-active slot 代表选中状态下的图标
```html
自定义
标签
标签
```
```javascript
Page({
data: {
active: 0,
icon: {
normal: '//img.yzcdn.cn/icon-normal.png',
active: '//img.yzcdn.cn/icon-active.png'
}
},
onChange(event) {
console.log(event.detail);
}
});
```
### Tabbar API
| 参数 | 说明 | 类型 | 默认值 |
|-----------|-----------|-----------|-------------|
| active | 当前选中标签的索引 | `Number` | - |
| fixed | 是否固定在底部 | `Boolean` | `true` |
| z-index | 元素 z-index | `Number` | `1` |
| safe-area-inset-bottom | 是否适配iPhoneX | `Boolean` | `true` |
### Tabbar Event
| 事件名 | 说明 | 参数 |
|-----------|-----------|-----------|
| bind:change | 切换标签时触发 | event.detail: 当前选中标签的索引 |
### TabbarItem API
| 参数 | 说明 | 类型 | 默认值 |
|-----------|-----------|-----------|-----------|
| icon | 图标名称或图片链接,可选值见 Icon 组件 | `String` | - |
| dot | 是否显示小红点 | `Boolean` | - |
| info | 图标右上角提示信息 | `String | Number` | - |
### TabbarItem Slot
| 名称 | 说明 |
|-----------|-----------|
| icon | 未选中时的图标 |
| icon-active | 选中时的图标 |
### 更新日志
| 版本 | 类型 | 内容 |
|-----------|-----------|-----------|
| 0.1.1 | feature | 新增组件 |
| 0.2.1 | bugfix | 修复 z-index 不生效的问题 |