【问题标题】:Fable.React: select input text on focusFable.React:选择焦点上的输入文本
【发布时间】:2019-04-27 06:15:36
【问题描述】:

我正在尝试使用 Fable.React 选择输入字段的文本。 在 js 中它可以像 this 一样完成,但在 Fable 中尝试相同的方法不会编译:

input [                         
        Type "text"
        OnFocus(fun e -> e.target.select())
      ]

如何在使用 Fable.React 获得焦点时选择输入字段中的文本?

【问题讨论】:

    标签: f# fable-f#


    【解决方案1】:

    解决方法是先投射event.target:

    OnFocus(fun e -> 
              let target = e.target :?> Browser.HTMLInputElement
              target.select()
            )
    

    【讨论】:

      猜你喜欢
      • 2013-02-06
      • 2013-05-13
      • 1970-01-01
      • 2017-09-26
      • 2011-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多