【问题标题】:React.JS onChange event not working with using unity-webglReact.JS onChange 事件无法使用 unity-webgl
【发布时间】:2018-03-31 19:08:31
【问题描述】:
import {Unity} from 'react-unity-webgl';

...

handleChange(event) {
    console.log(event.target.value);
}

render() {
    <div>
 ...
        <div>
            <Unity src="WebGL.json" />
        </div>
 ...
    <div>
      <input type="text" name="title" id="title" value={this.state.value} onChange={this.handleChange} />
    </div>
 ...
  </div>
}

这里的 onChange(Input) 事件运行良好,但在 Unity 集成后它根本不起作用。我尝试使用其他输入组件,但结果相同。

【问题讨论】:

  • handleChange 是否绑定到 this ?展示你如何声明你的组件以及如何绑定它?
  • 是的,handleChange 是绑定到这个的。
  • 您在控制台中看到任何错误吗?
  • 没有。控制台没有任何错误。
  • 什么不起作用?什么都没有记录?你用的是 es6 吗?

标签: javascript reactjs input onchange unity-webgl


【解决方案1】:

我自己解决了这个问题,并通过下面的链接发布了答案。

Here are the answer for this question.

【讨论】:

    猜你喜欢
    • 2018-04-21
    • 2017-05-02
    • 2020-05-07
    • 1970-01-01
    • 2018-03-03
    • 1970-01-01
    • 2018-04-19
    • 2019-10-12
    • 1970-01-01
    相关资源
    最近更新 更多