Picker
受控的 SwiftUI 选择器,支持菜单、分段、单选组和内联样式。
#导入
从 @quickgui/solid/swift-ui 导入 Picker。
import { Host, Picker } from "@quickgui/solid/swift-ui";#用法
<Host matchContents>
<Picker
label="Theme"
selection={theme()}
options={[
{ value: "system", label: "System" },
{ value: "light", label: "Light" },
{ value: "dark", label: "Dark" },
]}
style="menu"
onSelectionChange={setTheme}
/>
</Host>#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
Picker
查看源码Picker(props: PickerProps): NativeNodetestIDstring—
modifiersViewModifier[]—
selectionstring—
optionsreadonly PickerOption[]—
Declares options. Reactive JSX expressions update this property in place.
readonly PickerOption[]查看源码labelstring—
stylePickerStyle—
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查看源码