<div className={ this.state.focus ? "dis_bottom_left_onfocus" : "dis_bottom_left" } ref="bottom_left">
<input
type="text"
className="dis_bottom_input"
ref="bottom_input"
placeholder={this.props.mainName || "说点什么吧"}
onBlur={ ::this.inputOnBlur }
onFocus={ ::this.inputOnFocus } />
</div>
//input 获取焦点 width: 100%
inputOnFocus(){
this.setState({ focus: true });
} //input 失去焦点
inputOnBlur(){
this.setState({ focus: false });
}

react input 获取/失去焦点的更多相关文章

  1. 当input获取倒焦点的时候,获得输入内容

    描述:当用户点击输入框时,获取到他在input里输入的内容 $().keyup(function(){ $(this).val(); }) $(this).val()==this.value; $(t ...

  2. input获取永久焦点

    $(function () { $('#test').blur(function () { var that = this; //或者用闭包 setTimeout(function () { $(th ...

  3. js 获取当前焦点所在的元素、给元素和input控件添加键盘监听事件、添加页面级的键盘监听事件

    页面级的键盘监听事件 document.onkeydown = function (event) { var e = event || window.event || arguments.callee ...

  4. python坑之input获取字符串

    space = input("set user quotation:").strip() quotation = int(space* 1024 * 1024) print(quo ...

  5. react input的几个坑

    [react input的几个坑] 1.input标签中设置value后,input进入controlled模式,valuechange由自动变为手动,导致input无法编辑.如: <input ...

  6. WPF设置控件获取键盘焦点时的样式FocusVisualStyle

    控件获取焦点除了用鼠标外,可以通过键盘来获取,比如Tab键或者方向键等,需要设置控件获取键盘焦点时的样式,可以通过设置FrameworkElemnt.FocusVisualStyle属性, 因为几乎所 ...

  7. React onPaste 获取粘贴板的值

    React 中, 获取 粘贴板的值, 使用下面的方法 console.log(e.clipboardData.getData('Text')); 如果是 JS 中的 onpaste 事件, 则使用 v ...

  8. select2和bootstrap模态框一起使用导致select2的input获取不到焦点问题

      select2和bootstrap模态框一起使用导致select2的input获取不到焦点问题 解决办法: 把页面中的 tabindex="-1" 删掉, 或者值改为1 代码片 ...

  9. 哪种方式更适合在React中获取数据?

    作者:Dmitri Pavlutin 译者:小维FE 原文:dmitripavlutin.com 国外文章,笔者采用意译的方式,以保证文章的可读性. 当执行像数据获取这样的I/O操作时,你必须发起获取 ...

随机推荐

  1. 读书笔记:javascript高级技巧(二)

    四.惰性载入函数 因为浏览器兼容的原因,我们的javascript代码会有大量的if语句,将执行引导到正确的代码中,看如下函数: function createXHR(){ if (typeof XM ...

  2. 【POJ】3974 Palindrome

    http://poj.org/problem?id=3974 题意:求s的最长回文串.(|s|<=1000000) #include <cstdio> #include <cs ...

  3. POJ 1279 Art Gallery(半平面交)

    题目链接 回忆了一下,半平面交,整理了一下模版. #include <cstdio> #include <cstring> #include <string> #i ...

  4. 【CodeVS】 p1696 奇怪的函数

    题目描述 Description 自从得到上次的教训后,John的上课态度认真多了,也变得更爱动脑筋了.今天他又学习了一个新的知识:关于 xk 的位数. 如果x大于0小于l,那么位数=1+小数部分×k ...

  5. C#中如何在字符串中设置上标

    一.HTML中:如字符串"21st" 想要把st 设置为上标,在html标签中是21<sup>st</sup> 二.C#编辑器中你可以使用 unicode ...

  6. python mysql 单引号字符串过滤

    最主要用这个函数,可以处理MySQLdb.escape_string(content). class Guide: def __init__(self): self.time_zone = 7*360 ...

  7. java分享第一天(java环境及原理)

    1 JDK的安装目录中:环境变量中增加JAVA_HOME变量:JDK安装目录:在path中添加JDK的bin目录 2 java执行的顺序是: 1 用java编译器javac   XXX.java   ...

  8. Perform UPSERT / INSERT OR UPDATE against a SQLite Database

    Option 1: You can afford deleting the row In other words, you don't have foreign key, or if you have ...

  9. How to get SQLite work on windows phone 8

    1.Install SQLite for Windows Phone SDKC:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Exten ...

  10. Missing number

    Missing number 题目: Description There is a permutation without two numbers in it, and now you know wh ...