|
@@ -44,6 +44,7 @@ class SpreadDrop extends Component{
|
|
|
ban:{}, //放'伴'字段
|
|
|
editable:false, //双击编辑
|
|
|
labelVal:'', //存放标签原有的值--主诉字数限制用
|
|
|
+ tmpDom:null
|
|
|
};
|
|
|
this.$div = React.createRef();
|
|
|
this.handleSelect = this.handleSelect.bind(this);
|
|
@@ -72,12 +73,15 @@ class SpreadDrop extends Component{
|
|
|
const that = this;
|
|
|
this.btnClickFlag = false;
|
|
|
clearTimeout(this.state.timer);
|
|
|
- this.state.timer = setTimeout(function(){
|
|
|
+ this.state.timer = setTimeout(()=>{
|
|
|
if (that.state.editable) {//如果处于编辑状态点击不显示下拉框
|
|
|
return
|
|
|
}else{
|
|
|
document.activeElement.blur()//chrome41有效,但是失去焦点的span仍能编辑
|
|
|
$(e.target).parent().prev().attr({"contentEditable":false})
|
|
|
+ this.setState({
|
|
|
+ tmpDom:e.target
|
|
|
+ })
|
|
|
handleShow&&handleShow({ikey,placeholder,flag,id,value,tagType,type});
|
|
|
}
|
|
|
},300)
|
|
@@ -338,6 +342,10 @@ class SpreadDrop extends Component{
|
|
|
|
|
|
render(){
|
|
|
const {placeholder,value,show,data,order} = this.props;
|
|
|
+ const {tmpDom} = this.state
|
|
|
+ if(!show&&tmpDom){
|
|
|
+ $(tmpDom).parent().prev().attr({"contentEditable":true})
|
|
|
+ }
|
|
|
const {editable} = this.state;
|
|
|
return <div className={style['container']}
|
|
|
onFocus={(e)=>e.stopPropagation()}
|