首页 > 解决方案 > 如何使用 React/Ionic 设置活动的 IonicSegmentButton?

问题描述

我正在尝试将特定的细分按钮设置为活动状态,并且我一直在寻找如何做到这一点。Angular/Ionic 似乎有可能,但我正在使用 React 并且无法找到 React 的答案。

这是代码:

<IonItem>
     <IonText>Status<IonText color="danger">*</IonText></IonText>
     <IonSegment id="event_status">
          <IonSegmentButton value="close">
               <IonLabel>Close</IonLabel>
          </IonSegmentButton>
          <IonSegmentButton value="open">
               <IonLabel>Open</IonLabel>
          </IonSegmentButton>
     </IonSegment>
</IonItem>

我想将关闭按钮设置为活动按钮

标签: javascriptreactjsionic-framework

解决方案


因为它对您有用,所以其他人也可以得到帮助:

尝试在主<IonSegment id="event_status" value="close">标签上设置值。

希望它会起作用


推荐阅读