Fable.React: select 焦点输入文本
Fable.React: select input text on focus
我正在尝试 select 使用 Fable.React 的输入字段的文本。
在 js 中可以像 那样完成,但在 Fable 中尝试相同的方法不会编译:
input [
Type "text"
OnFocus(fun e -> e.target.select())
]
如何 select 使用 Fable.React 聚焦输入字段中的文本?
解决方法是先投event.target:
OnFocus(fun e ->
let target = e.target :?> Browser.HTMLInputElement
target.select()
)
我正在尝试 select 使用 Fable.React 的输入字段的文本。
在 js 中可以像
input [
Type "text"
OnFocus(fun e -> e.target.select())
]
如何 select 使用 Fable.React 聚焦输入字段中的文本?
解决方法是先投event.target:
OnFocus(fun e ->
let target = e.target :?> Browser.HTMLInputElement
target.select()
)