javascript - 如何输入字符串的最后一个字符以刷新页面
问题描述
我正在对文本输入进行实验,目前,单击按钮将激活新的试用。我希望在不使用按钮的情况下激活新试用版(即在用户输入目标短语的最后一个字符时自动出现)。这是我到目前为止的代码:
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(){
解决方案
推荐阅读
- symfony - Elastica、KNP 分页器和结果集 > 10000
- javascript - Javascript,跟踪 iframe 重定向顶部窗口
- python - numpy广播的keras回调错误
- java - Apache kafka - 从 java 应用程序打印到控制台
- android - 我想为点击的特定图标添加行为
- node.js - 等待从数据库返回数据 - ajax 和 express
- android - RecyclerView 使用 RxJava 无限滚动
- assembly - 如何在nasm中打印反向字符串?
- class - TclOO:类记录器混合
- android - Xamarin Android 回调未调用 ShouldOverrideUrlLoading