小编Gui*_*rmo的帖子

按下输入React.js时,请关注下一个字段

当我使用React.js单击输入时,我想找到一种方法来关注下一个字段

  @autobind
  handleKeyPress(event){
    if(event.key === 'Enter'){
      this.refs.email.focus();
    }
  }

  @autobind
  handleKeyPressEmail(event){
    if(event.key === 'Enter'){
      this.refs.zip_code.focus();
    }
  }

        <input
          onKeyPress={this.handleKeyPress}
          ref = 'name'
        />

        <input
          onKeyPress={this.handleKeyPressEmail}
          ref = 'email'
        />

        <input
          ref = 'zip_code'
        />
Run Code Online (Sandbox Code Playgroud)

这是我到目前为止找到的最好的方法,但是我不希望每当我希望这种情况发生时创建一个函数来重复自己.是否有更好,更清洁的方式来实现这一点?

javascript reactjs

13
推荐指数
3
解决办法
2万
查看次数

在Elastic Beanstalk中更新Nodejs版本

我们在生产中遇到了节点版本的一些问题,因此我们将package.jsonfrom中所需的版本更改0.10.06.2.2..

  "engines": {
    "node": ">= 6.2.2"
  }
Run Code Online (Sandbox Code Playgroud)

但是在Elastic Beanstalk中,创建新实例时,它们的节点版本为0.10.0.我们如何更新Elastic Beanstalk中的版本,以便创建的新实例具有所需的版本package.json

非常感谢你.

amazon-web-services node.js

7
推荐指数
1
解决办法
6070
查看次数