feat(tabbar): 添加本地图标支持并更新文档
- 在tabbar组件中添加对本地图标类型的支持 - 更新README文档,增加tabbar策略说明 - 调整pages.json配置,将首页图标改为本地类型 - 完善配置文件的TODO注释说明
This commit is contained in:
@@ -43,6 +43,10 @@ const inactiveColor = '#666'
|
||||
function getColorByIndex(index: number) {
|
||||
return tabbarStore.curIdx === index ? activeColor : inactiveColor
|
||||
}
|
||||
|
||||
function getImageByIndex(index: number, item: { iconActive: string, icon: string }) {
|
||||
return tabbarStore.curIdx === index ? item.iconActive : item.icon
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -68,6 +72,9 @@ function getColorByIndex(index: number) {
|
||||
<template v-if="item.iconType === 'unocss' || item.iconType === 'iconfont'">
|
||||
<view :class="item.icon" class="text-20px" />
|
||||
</template>
|
||||
<template v-if="item.iconType === 'local'">
|
||||
<image :src="getImageByIndex(index, item)" mode="scaleToFill" class="h-20px w-20px" />
|
||||
</template>
|
||||
<view class="mt-2px text-12px">
|
||||
{{ item.text }}
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user