边缘tab继续滑动可以通过给TabContent添加手势进行限制。具体方案如下:最左侧的TabContent添加.gesture(PanGesture(new PanGestureOptions({ direction: PanDirection.Right })))。对最右侧的TabContent添加.gesture(PanGesture(new PanGestureOptions({ direction: PanDirection.Left })))。demo:@Entry @Component struct Index { private controller: TabsController = new TabsController() build() { Tabs({barPosition: BarPosition.Start, controller: this.controller}){ TabContent(){ Text("123") }.gesture(PanGesture(new PanGestureOptions({ direction: PanDirection.Right }))) TabContent(){ Text("456") }.gesture(PanGesture(new PanGestureOptions({ direction: PanDirection.Left }))) } .barHeight(0) .vertical(false) .scrollable(true) .onChange((index: number) => { }) } }
边缘tab继续滑动可以通过给TabContent添加手势进行限制。
具体方案如下:
最左侧的TabContent添加.gesture(PanGesture(new PanGestureOptions({ direction: PanDirection.Right })))。
对最右侧的TabContent添加.gesture(PanGesture(new PanGestureOptions({ direction: PanDirection.Left })))。
demo: