【问题标题】:How to set tabindex attribute如何设置tabindex属性
【发布时间】:2019-10-01 14:06:16
【问题描述】:

使用 Binding.scala 时,我无法编写使用 tabindex 属性的 html。 这是 Binding.scala / scala.js 中的错误吗?

  <div>
    <input tabindex="1"></input>
    <input tabindex="3"></input>
    <br></br>
    <input tabindex="2"></input>
    <input tabindex="4"></input>
  </div>

导致编译错误:

ScalaFiddle.scala:12: error: value tabindex is not a member of scalajs.this.dom.html.Input
ScalaFiddle.scala:13: error: value tabindex is not a member of scalajs.this.dom.html.Input
ScalaFiddle.scala:15: error: value tabindex is not a member of scalajs.this.dom.html.Input
ScalaFiddle.scala:16: error: value tabindex is not a member of scalajs.this.dom.html.Input

我尝试使用属性(或属性?)tabIndex,但它不是字符串,属性参数需要是字符串。

例如看这个:https://scalafiddle.io/sf/kDg2uAA/0

我对 scala、sbt 和 scala.js 还是很陌生,所以我不确定在哪里/如何修复这个问题,以及如何在创建 pullrequest 之前在本地测试修复。

【问题讨论】:

    标签: binding.scala


    【解决方案1】:

    您可以使用 tabIndex 属性和包含在 {} 中的值(提示:您可以在其中使用任何 scala 代码!)。

    <div>
      <input tabIndex={1}></input>
      <input tabIndex={3}></input>
      <br></br>
      <input tabIndex={2}></input>
      <input tabIndex={4}></input>
    </div>
    

    请在此处查看完整代码:https://scalafiddle.io/sf/hGkAVib/1

    【讨论】:

      【解决方案2】:

      您需要使用 data:tabindex 属性。请看https://scalafiddle.io/sf/TlcSdfF/1

      【讨论】:

      猜你喜欢
      • 2010-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-02
      相关资源
      最近更新 更多