如何在 ionic 2 中制作可滑动的段标签?

DEE*_*MAR 1 ionic2

我想添加更多数量的标签,有什么解决方案可以在这些标签上滑动吗?

<ion-segment [(ngModel)]="query" (ionChange)="showdata()">
<ion-segment-button value="slide1">
 TabTitle1
</ion-segment-button>
<ion-segment-button value="slide2">
 TabTitle2
</ion-segment-button>
<ion-segment-button value="slide3">
 TabTitle3
</ion-segment-button>
</ion-segment> 
Run Code Online (Sandbox Code Playgroud)

小智 5

添加下面的CSS,这将起作用

供参考:- https://github.com/driftyco/ionic/issues/7202

home {
.swiper-slide {
overflow-y: scroll;
display: block;
}

ion-segment {
    display: block;
    white-space: nowrap;
    font-size: 0;
    overflow: auto;

    &::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }

    ion-segment-button.segment-button {
        display: inline-block;
        min-width: 100px;
        width: auto;
    }
}
/*
ion-segment-button.segment-button {
    display: inline-block!important;
    min-width: 100px!important;
    width: auto!important;
    }*/

}
Run Code Online (Sandbox Code Playgroud)