SegmentedControl
原生分段选择器,支持值选择和中性的 Xcode 风格标签页角色。
#导入
从 @quickgui/solid/swift-ui 导入 SegmentedControl。
import { Host, SegmentedControl } from "@quickgui/solid/swift-ui";#用法
<Host matchContents>
<SegmentedControl
role="tabs"
selection={layout()}
options={[
{ value: "list", label: "List" },
{ value: "grid", label: "Grid" },
]}
onSelectionChange={setLayout}
/>
</Host>#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
SegmentedControl
查看源码SegmentedControl(props: SegmentedControlProps): NativeNodetestIDstring—
modifiersViewModifier[]—
selectionstring—
optionsreadonly PickerOption[]—
Declares options. Reactive JSX expressions update this property in place.
readonly PickerOption[]查看源码labelstring—
onSelectionChange(selection: string, event: QuickGuiEvent) => void—
Declares onSelectionChange (optional). Reactive JSX expressions update this property in place.
(selection: string, event: QuickGuiEvent) => void查看源码ref((node: NativeNode) => void) | NativeNode—
Declares ref (optional). Reactive JSX expressions update this property in place.
((node: NativeNode) => void) | NativeNode查看源码