跳到正文

TextField

受控的原生 SwiftUI 文本字段,提供编辑和提交回调。

#导入

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

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

#用法

<Host matchContents={{ vertical: true }} style={{ width: 280 }}>
  <TextField
    value={name()}
    placeholder="Name"
    onValueChange={setName}
    onSubmit={save}
  />
</Host>

#API 参考

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

TextField

查看源码
TextField(props: TextFieldProps): NativeNode
testIDstring—

Stable identifier exposed to macOS accessibility and UI testing.

string
查看源码
modifiersViewModifier[]—

SwiftUI modifiers, applied in array order.

ViewModifier[]
查看源码
valuestring—

Controlled field value.

string
查看源码
placeholderstring—

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

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

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

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

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

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

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

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