import React, { Component } from "react"; import $ from 'jquery'; import config from '@config/index'; 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); } componentDidMount(){ const {item} = this.props this.setState({value:item.time}) } handleInput(e,item,sign,idx){ const {setTipValue,handlePush} = this.props; setTipValue(item,e.target.value,sign,idx) //右侧推送--延时推送 const stimer = this.state.timer; clearTimeout(stimer); let timer = setTimeout(function(){ handlePush&&handlePush({mode:8}); clearTimeout(stimer); },config.delayPushTime); this.setState({timer}) } handleFocus(){ const {handlePush} = this.props; handlePush&&handlePush({mode:8}); } setEdit(e){ $(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.handleInput(e,item,1,idx)}} onFocus={()=>{this.handleFocus()}} /> ); } } export default SlideIpt;