feat(tabbar): 添加本地图标支持并更新文档

- 在tabbar组件中添加对本地图标类型的支持
- 更新README文档,增加tabbar策略说明
- 调整pages.json配置,将首页图标改为本地类型
- 完善配置文件的TODO注释说明
This commit is contained in:
feige996
2025-08-04 18:19:20 +08:00
parent 4da8e4a43a
commit 80985805e0
3 changed files with 21 additions and 9 deletions

View File

@@ -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>