如何创建图形上类似于离子输入的 ion-select?

How to create a ion-select which is graphically like a ion-input?

我想要得到的是一个<ion-select> that is equal to a <ion-input>带有堆叠标签的

我现在拥有的:

我想要的:

当然这个要有右边的小三角才能选

没有 built-in 的功能。您可以构建自己的,但这是一项相当复杂的工作。幸运的是,有一个名为 ionic-select-searchable 的自定义组件可以执行此操作:

只需按照该页面上的说明进行安装并将其添加到您的页面即可。

你可以这样做:

.html

<ion-list>
    <ion-item style="padding-bottom: 10px; min-height: 6.4rem;">
        <ion-label color="primary" stacked>Music</ion-label>
        <ion-select style="height: 100%; padding-bottom: 0px; font-weight: 500;">
            <ion-option *ngFor="let temp of musicArr">{{ temp.name }}</ion-option>
        </ion-select>
    </ion-item>
</ion-list>