需求:在uniapp项目内,自定义tabbar,需要将图标更换成svg格式,可动态修改图标及字体颜色。
效果图如下:
我使用的是uniapp结合uview2的组件使用,代码如下:
<u-tabbar :value="currentIndex" @change="tabbarChange" :fixed="true" :activeColor="themeColor":safeAreaInsetBottom="true" zIndex='99'><u-tabbar-item v-for="(item,index) in tabbarList" :key="index" :text="item.text":badge="item.isBadge?carNum:''"><!-- 选中的svg --><view class="u-page__item__slot-icon tabbarItemIcon"slot="active-icon" :style="{backgroundImage: 'url('+item.selectedIconPath+')'}"></view><!-- 未选中的svg --><view class=