[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
+3 -1
View File
@@ -13,7 +13,9 @@
<van-tabbar v-model="active2">
<van-tabbar-item icon="shop">
<span>{{ $t('custom') }}</span>
<img slot="icon" :src="active2 === 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">{{ $t('tab') }}</van-tabbar-item>
<van-tabbar-item icon="records">{{ $t('tab') }}</van-tabbar-item>