import React, { Component } from "react"; import $ from 'jquery'; class SlideIpt extends Component { constructor(props) { super(props); this.state = { show:false, activeInd:false, activeName:'', canEdit:true, style:'', value:'' }; this.setEdit = this.setEdit.bind(this); this.handleBlur = this.handleBlur.bind(this); } componentDidMount(){ const {item} = this.props this.setState({value:item.time}) } handleInput(e,item,sign){ e.stopPropagation(); const {setTipValue} = this.props setTipValue(item,e.target.value,sign) } handleInputTime(e){ this.setState({value:e.target.value}) } handleBlur(e,item,sign){ const {handlePush,setTipValue} = this.props; $('.canEdit').attr('disabled','disabled') setTipValue(item,e.target.value,sign) handlePush && handlePush({mode:8}); //右侧推送 } setEdit(e){ // $('.canEdit').blur().attr('disabled','disabled') $(e.target).removeAttr('disabled').focus() } render() { const {item,idx} = this.props; return ( this.setEdit(e)} style={{color:'#333'}} placeholder='时间' autoComplete="off" value={this.state.value} onInput={(e)=>{this.handleInputTime(e)}} onBlur={(e)=>{this.handleBlur(e,item,1,idx)}} /> ); } } export default SlideIpt;