|
@@ -29,6 +29,7 @@ class NumberUnitDrop extends Component{
|
|
labelVal:''
|
|
labelVal:''
|
|
};
|
|
};
|
|
this.$span = React.createRef();
|
|
this.$span = React.createRef();
|
|
|
|
+ this.$cont = React.createRef();
|
|
this.select = this.select.bind(this);
|
|
this.select = this.select.bind(this);
|
|
this.numInpBlur = this.numInpBlur.bind(this);
|
|
this.numInpBlur = this.numInpBlur.bind(this);
|
|
this.handleSpanInp = this.handleSpanInp.bind(this);
|
|
this.handleSpanInp = this.handleSpanInp.bind(this);
|
|
@@ -114,10 +115,15 @@ class NumberUnitDrop extends Component{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
getClasses(){ //整个标签是否有值的状态
|
|
getClasses(){ //整个标签是否有值的状态
|
|
- const {value,hideTag} = this.props;
|
|
|
|
|
|
+ const {value,hideTag,show} = this.props;
|
|
const inpValue = this.state.value;
|
|
const inpValue = this.state.value;
|
|
const isSelected = value||inpValue?style['selected']:style['container'];
|
|
const isSelected = value||inpValue?style['selected']:style['container'];
|
|
const noTag = hideTag?style['no-tag']:'';
|
|
const noTag = hideTag?style['no-tag']:'';
|
|
|
|
+ if(show){
|
|
|
|
+ $(this.$cont.current).addClass(style['borderd']);
|
|
|
|
+ }else{
|
|
|
|
+ $(this.$cont.current).removeClass(style['borderd']);
|
|
|
|
+ }
|
|
return className(isSelected,noTag);
|
|
return className(isSelected,noTag);
|
|
}
|
|
}
|
|
changeToEdit(e){ //整个标签双击编辑状态
|
|
changeToEdit(e){ //整个标签双击编辑状态
|
|
@@ -146,7 +152,7 @@ class NumberUnitDrop extends Component{
|
|
render(){
|
|
render(){
|
|
const {placeholder,prefix,suffix,show,value,handleHide} = this.props;
|
|
const {placeholder,prefix,suffix,show,value,handleHide} = this.props;
|
|
const {numEditable,editable,hasSelect,placeholderFlag} = this.state;
|
|
const {numEditable,editable,hasSelect,placeholderFlag} = this.state;
|
|
- return <div className={this.getClasses()}>
|
|
|
|
|
|
+ return <div className={this.getClasses()} ref={this.$cont}>
|
|
<span>{prefix}</span>
|
|
<span>{prefix}</span>
|
|
<span onClick={this.handleNumClick}
|
|
<span onClick={this.handleNumClick}
|
|
contentEditable={editable}
|
|
contentEditable={editable}
|