点击tabbar

This commit is contained in:
XiuYun CHEN
2025-06-05 14:10:30 +08:00
parent ca5ab146b7
commit efcb4be65a
11 changed files with 37 additions and 6 deletions
@@ -14,7 +14,8 @@ export struct TabBarComp {
@State
isLandscape: boolean = false
listenerScreen = mediaquery.matchMediaSync('(orientation: landscape) and (device-type: tablet)')
@Provide
toTop:boolean=false;
aboutToAppear() {
this.listenerScreen.on('change', (mediaQueryResult) => {
this.isLandscape = mediaQueryResult.matches
@@ -53,6 +54,7 @@ export struct TabBarComp {
.barPosition(this.isLandscape ? BarPosition.Start : BarPosition.End)
.onTabBarClick((index) => {
this.activeIndex = index
this.toTop=!this.toTop
})
.barHeight(this.isLandscape ? $r('app.float.tab_bar_item_height_lg') : $r('app.float.tab_bar_item_height_sm'))
.scrollable(false)