跳到正文

Slider

受控的原生滑块,支持连续值或步进值。

#导入

从 @quickgui/solid/swift-ui 导入 Slider。

import { Host, Slider } from "@quickgui/solid/swift-ui";

#用法

<Host matchContents={{ vertical: true }} style={{ width: 360 }}>
  <Slider
    value={volume()}
    min={0}
    max={1}
    step={0.05}
    label="Volume"
    onValueChange={setVolume}
  />
</Host>

#API 参考

展开条目查看说明和完整签名。短横线表示声明中未记录默认值。

Slider(props: SliderProps): NativeNode
testIDstring—

Stable identifier exposed to macOS accessibility and UI testing.

string
查看源码
modifiersViewModifier[]—

SwiftUI modifiers, applied in array order.

ViewModifier[]
查看源码
valuenumber—

Controlled slider value.

number
查看源码
minnumber—

Declares min (optional). Reactive JSX expressions update this property in place.

number
查看源码
maxnumber—

Declares max (optional). Reactive JSX expressions update this property in place.

number
查看源码
stepnumber—

Omit for a continuous slider.

number
查看源码
labelstring—

Declares label (optional). Reactive JSX expressions update this property in place.

string
查看源码
onValueChange(value: number, event: QuickGuiEvent) => void—

Declares onValueChange (optional). Reactive JSX expressions update this property in place.

(value: number, event: QuickGuiEvent) => void
查看源码
ref((node: NativeNode) => void) | NativeNode—

Declares ref (optional). Reactive JSX expressions update this property in place.

((node: NativeNode) => void) | NativeNode
查看源码