如何解决具有多条线的离子段
尝试将 6 个元素放入 1 或 2 行(取决于屏幕宽度)但没有成功。通过添加和元素获得了部分成功。如有必要,元素可以很好地分成 2 行,但会出现一个奇怪的故障:如果我再次单击所选按钮,选择将完全消失。
<ion-segment [(ngModel)]="doorColour" value="white">
<ion-grid>
<ion-row>
<ion-segment-button value="white">
<ion-label>White</ion-label>
</ion-segment-button>
<ion-segment-button value="sandstone">
<ion-label>Sandstone</ion-label>
</ion-segment-button>
<ion-segment-button value="almond">
<ion-label>Almond</ion-label>
</ion-segment-button>
<ion-segment-button value="bronze">
<ion-label>bronze</ion-label>
</ion-segment-button>
<ion-segment-button value="black">
<ion-label>Black</ion-label>
</ion-segment-button>
<ion-segment-button value="forest green">
<ion-label>Forest Green</ion-label>
</ion-segment-button>
</ion-row>
</ion-grid>
</ion-segment>
请指教。
解决方法
使用 scrollable
和 mode='md'
来滚动分段
<ion-segment [(ngModel)]="doorColour" value="white" scrollable mode="md">
<ion-segment-button value="white">
<ion-label>White</ion-label>
</ion-segment-button>
<ion-segment-button value="sandstone">
<ion-label>Sandstone</ion-label>
</ion-segment-button>
<ion-segment-button value="almond">
<ion-label>Almond</ion-label>
</ion-segment-button>
<ion-segment-button value="bronze">
<ion-label>Bronze</ion-label>
</ion-segment-button>
<ion-segment-button value="black">
<ion-label>Black</ion-label>
</ion-segment-button>
<ion-segment-button value="forest green">
<ion-label>Forest Green</ion-label>
</ion-segment-button>
</ion-segment>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。