[improvement] TabbarItem: add slot-scope to avoid check by index (#347)

* [improvement] TabbarItem: add slot-scope to avoid check by index

* [fix] TabbarItem: fix slot-scope on <template> to support vue v2.1.0+
This commit is contained in:
Li Chuangbo
2017-11-24 11:10:32 +08:00
committed by neverland
parent 1f1632a7eb
commit f7bd71969d
4 changed files with 23 additions and 5 deletions
+9 -1
View File
@@ -38,7 +38,9 @@ Use `icon` slot to custom icon
<van-tabbar v-model="active">
<van-tabbar-item icon="shop">
<span>Custom</span>
<img slot="icon" :src="active === 0 ? icon.active : icon.normal" />
<template slot="icon" slot-scope="props">
<img :src="props.active ? icon.active : icon.normal" />
</template>
</van-tabbar-item>
<van-tabbar-item icon="chat">Tab</van-tabbar-item>
<van-tabbar-item icon="records">Tab</van-tabbar-item>
@@ -81,3 +83,9 @@ export default {
| url | Link | `String` | - | - |
| to | Target route of the link, same as to of `vue-router` | `String | Object` | - | - |
| replace | If true, the navigation will not leave a history record | `String` | `false` | - |
### TabbarItem Slot
| Name | Description | Scope |
|-----------|-----------|-----------|
| icon | Custom icon | active |