gpt4 book ai didi

angular - ionic 2 中的可滚动段(水平)

转载 作者:太空狗 更新时间:2023-10-29 17:23:12 26 4
gpt4 key购买 nike

我正在尝试使用 ionic2 中的段进行水平滚动。这是代码:

主页.ts:

<ion-scroll scrollX="true" style="width:100vw;height:350px" >
<ion-segment [(ngModel)]="relationship" color="primary">


<ion-segment-button value="friends" (ionSelect)="selectedFriends()">
Friends
</ion-segment-button>
<ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
Enemies
</ion-segment-button>
<ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
Enemies
</ion-segment-button>
<ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
Enemies
</ion-segment-button>
<ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
Enemies
</ion-segment-button>
<ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
Enemies
</ion-segment-button>
<ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
Enemies
</ion-segment-button>
<ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
Enemies
</ion-segment-button>
<ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
Enemies
</ion-segment-button>
<ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
Enemies
</ion-segment-button>

</ion-segment>
</ion-scroll>

根据 this document,我在 ion-segment 之外使用了 ion-scroll,所以我得到了这样的 UI。

image

How can I make my name visible depending upon the length of the name and show only 3 to 4 names. After the user scroll, it should show the next names one by one.

最佳答案

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;
}
}

工作正常

关于angular - ionic 2 中的可滚动段(水平),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42431348/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com