暂时没有tabBar点击拦截功能实现,可以使用TabsController自定义页签以及并在其中添加事件进行逻辑判断,参考demo如下:export class ButtonInfoModel { index: number = 0; info: string = 'home'; title: string = 'Home'; } const buttonInfo: ButtonInfoModel[] = [ { index: 0, info: 'home', title: 'Home' }, { index: 1, info: 'map', title: 'Map' }, { index: 2, info: 'charging', title: 'Charging' } ] @Component export struct Home { @State message: string = 'Home'; build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) Text('点击之后无法进入charging页,会跳转map页') .fontSize(20) .fontWeight(FontWeight.Bold) .onClick(() => { buttonInfo[2].info = "map" }) } .width('100%') } .height('100%') } } @Component export struct Map { @State message: string = 'Map'; build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) } .width('100%') } .height('100%') } } @Component export struct Charging { @State message: string = 'Charging'; build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) } .width('100%') } .height('100%') } }
暂时没有tabBar点击拦截功能实现,可以使用TabsController自定义页签以及并在其中添加事件进行逻辑判断,参考demo如下: