HarmonyOS 鸿蒙Next 关于tab组件的tabbar属性,这个情况算不算bug?
HarmonyOS 鸿蒙Next 关于tab组件的tabbar属性,这个情况算不算bug?
只贴主要代码,此代码的预览效果是tabbar的图标能够跟随选择正常变化,但文字颜色不同步,要点两次文字才会变色。
import { CommonConstants } from '../common/CommonConstants'
@Entry
@Componentstruct
class Index {
@State currentIndex: number = 0
build() {
Tabs(){
ForEach(CommonConstants.TAB_BAR_ARRAY,(item,index)=>{
TabContent(){}
.tabBar({
icon:index===this.currentIndex? item.selectedIcon : item.defaultIcon,
text:item.content
})
},item => JSON.stringify(item))
}
.barPosition(BarPosition.End)
.onChange(index=>{
this.currentIndex = index
})
}
}

