首页 > 解决方案 > 如何输入字符串的最后一个字符以刷新页面

问题描述

我正在对文本输入进行实验,目前,单击按钮将激活新的试用。我希望在不使用按钮的情况下激活新试用版(即在用户输入目标短语的最后一个字符时自动出现)。这是我到目前为止的代码:

saveData = () => {

    let log_file = JSON.stringify({
        targetPhrase: this.state.targetPhrase,
        inputPhrase: this.state.inputPhrase,
        timeElapsed: (new Date().getTime() - timeStart)/1000,

    })
    download(log_file, "results.txt", "text/plain");
    timer=0;
    this.type='normal';
    state +=1;
    if((state>2 && state <7) || (state>10 && state <15)){
        this.type='zoom';
    }

};

onClick = () =>{

  this.saveData();
  this.setState({
        targetPhrase : getTargetPhrase(),
        inputPhrase: "",
        inputChar: "",

  });
};
onInput = () =>{return this.state.inputPhrase;};

render(){

标签: javascriptnode.js

解决方案


推荐阅读