简体   繁体   English

从 ion-select 中删除 ion-radio - Ionic v4

[英]Remove ion-radio from ion-select - Ionic v4

I would like to remove ion-radio which are generated when i call ion-select (with a popover interface)我想删除调用 ion-select 时生成的 ion-radio(带有弹出界面)

<ion-item>
    <ion-label>Popover</ion-label>
    <ion-select interface="popover" placeholder="Select One">
      <ion-select-option value="brown">Brown</ion-select-option>
      <ion-select-option value="blonde">Blonde</ion-select-option>
      <ion-select-option value="black">Black</ion-select-option>
      <ion-select-option value="red">Red</ion-select-option>
    </ion-select>
</ion-item>

the code above generates ion-radio elements in the shadow DOM.上面的代码在 shadow DOM 中生成 ion-radio 元素。

I tried to select them (trying a display: none, or modifying a property with css4 (--border-width for example)).我尝试选择它们(尝试显示:无,或使用 css4 修改属性(例如 --border-width))。

I also tried the interfaceOptions method [interfaceOptions]="{cssClass:'custom-popover'}", without success.我也尝试了 interfaceOptions 方法 [interfaceOptions]="{cssClass:'custom-popover'}",但没有成功。

Thanks a lot非常感谢

Can you try with mode="ios".您可以尝试使用 mode="ios"。

<ion-select placeholder="Select One" mode="ios">
  <ion-select-option value="f">Female</ion-select-option>
  <ion-select-option value="m">Male</ion-select-option>
</ion-select>

If anyone comes looking for an answer, simple solution:如果有人来寻找答案,简单的解决方案:

  1. add the attribute [interfaceOptions]="customOptions" to the ion-select tag将属性 [interfaceOptions]="customOptions" 添加到 ion-select 标签
  2. in the component.ts file add a property (before constructor) customOptions = { mode: 'ios' };在 component.ts 文件中添加一个属性(在构造函数之前) customOptions = { mode: 'ios' };

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM