UI视图
TextEditor
编辑较长的多行文本。
受控、可滚动的文本区域,适合笔记等长文本。用 frame 指定高度。
import { Modifier, TextEditor, useState } from "onescript/views"
function NotesEditor() {
const [notes, setNotes] = useState("")
return (
<TextEditor
value={notes}
onChange={setNotes}
modifier={Modifier.frame({ height: 160 })}
/>
)
}| Prop | Type | 说明 |
|---|---|---|
value | string | 当前文本。 |
onChange | (value: string) => void | 用户修改文本时执行。 |
TextEditor 没有占位提示。如果是随内容增高的短文本,请改用 axis="vertical" 的 TextField。
也支持修饰符。仅在 App 和 Action 视图会话中可用;在 Widget 中使用会报「不支持的视图类型」错误。
How is this guide?
最后更新于