如何使用 React/Ionic 设置活动的 IonicSegmentButton?



我正在尝试将特定的段按钮设置为活动状态,我一直在寻找如何做到这一点。这似乎是可能的,但我正在使用 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>

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

因为它对您有用,因此可以作为答案发布,以便其他人也可以获得帮助:

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

希望它会起作用

最新更新