如启动后tabs默认3个tab,登录后需要新增加2个tab并刷新,怎么重新渲染,麻烦给出详细代码
Tabs({ barPosition: BarPosition.Start }) {
ForEach(this.tabBarArray, (tabsItem: HomeTypeModel) => {
TabContent() {
Column() {
HomeList({ currentIndex: tabsItem.id, type: tabsItem.type })
}.width('100%').height('100%').backgroundColor('#ffffff')
}.tabBar(this.tabMainBuilder(tabsItem.id, tabsItem.name))
})
}
可以参考以下demo实现:
定义一个字段是否登录,来记录状态
登录状态修改的地方 设置即可