在我的项目中,我的任务是为列表创建一个可滚动的筛选按钮。我想要么使用ion-slides,要么使用ion-segment,但是使用离子幻灯片不能让我选择改变片段,而ion-segment不符合设计的要求(滚动之前显示的3.5个按钮,精确的页边距)。因此,我想出了以下几点:
<ion-segment scrollable="true" (ionChange)="segmentChange($event)">
<ion-slides [options]="slideOption">
<ion-slide>
<ion-segment-button class="buttonActive" value="a">A</ion-segment-button>
</ion-slide>
<ion-slide>
<ion-segment-button class="button" value="b">B</ion-segment-button>
</ion-slide>
<ion-slide>
<ion-segment-button class="button" value="c">C</ion-segment-button>
</ion-slide>
<ion-slide>
<ion-segment-button class="button" value="d">D</ion-segment-button>
</ion-slide>
</ion-slides>
</ion-segment>我想知道我的方法是否正确,还是有一个更简单的解决方案。这个方法也给了我一个无法在ion-segment中创建填充的问题(我尝试将ion-label放入其中,但不能创建空格,这样文本就变得更加居中)。
发布于 2022-03-08 09:55:14
你正在按下键关闭按钮。在同一条线上关闭。
https://stackoverflow.com/questions/71392949
复制相似问题