|
@@ -21,6 +21,7 @@ class NumberDrop extends Component{
|
|
editable:false, //标签是否可输入
|
|
editable:false, //标签是否可输入
|
|
timer:null,
|
|
timer:null,
|
|
sltTimer:null,
|
|
sltTimer:null,
|
|
|
|
+ blurTimer:null,
|
|
hasSelect:false, //是否点过下拉键盘
|
|
hasSelect:false, //是否点过下拉键盘
|
|
boxLeft:0,
|
|
boxLeft:0,
|
|
boxTop:0,
|
|
boxTop:0,
|
|
@@ -45,6 +46,7 @@ class NumberDrop extends Component{
|
|
select(text){ //选中键盘上数字事件
|
|
select(text){ //选中键盘上数字事件
|
|
let timer = null;
|
|
let timer = null;
|
|
clearTimeout(this.state.sltTimer);
|
|
clearTimeout(this.state.sltTimer);
|
|
|
|
+ clearTimeout(this.state.blurTimer);
|
|
const {handleSelect,ikey,suffix,prefix,mainSaveText,min,max} = this.props;
|
|
const {handleSelect,ikey,suffix,prefix,mainSaveText,min,max} = this.props;
|
|
const needCompare=min!=undefined&&max!=undefined;
|
|
const needCompare=min!=undefined&&max!=undefined;
|
|
if(!text){
|
|
if(!text){
|
|
@@ -164,9 +166,9 @@ class NumberDrop extends Component{
|
|
numInpBlur(e){ //数字框失焦,保存值到store中
|
|
numInpBlur(e){ //数字框失焦,保存值到store中
|
|
e.stopPropagation();
|
|
e.stopPropagation();
|
|
const {handleSelect,ikey,suffix,prefix,mainSaveText,min,max,show} = this.props;
|
|
const {handleSelect,ikey,suffix,prefix,mainSaveText,min,max,show} = this.props;
|
|
- if(show){ //修改清空后第一次点击键盘不触发click事件bug
|
|
|
|
|
|
+ /*if(show){ //修改清空后第一次点击键盘不触发click事件bug
|
|
return;
|
|
return;
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
//输入超出合理范围或输入不是数字提示且清空
|
|
//输入超出合理范围或输入不是数字提示且清空
|
|
const needCompare=min!=undefined&&max!=undefined;
|
|
const needCompare=min!=undefined&&max!=undefined;
|
|
//if(needCompare){
|
|
//if(needCompare){
|
|
@@ -181,11 +183,16 @@ class NumberDrop extends Component{
|
|
//}
|
|
//}
|
|
|
|
|
|
//输入为空时显示placeholder
|
|
//输入为空时显示placeholder
|
|
- if(!e.target.innerText.trim()){
|
|
|
|
- this.setState({
|
|
|
|
- placeholder:this.props.placeholder
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ const timer = setTimeout(()=>{
|
|
|
|
+ if(!e.target.innerText.trim()){
|
|
|
|
+ this.setState({
|
|
|
|
+ placeholder:this.props.placeholder
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },200);
|
|
|
|
+ this.setState({
|
|
|
|
+ blurTimer:timer
|
|
|
|
+ });
|
|
|
|
|
|
const val = e.target.innerText.trim();
|
|
const val = e.target.innerText.trim();
|
|
const {placeholder} = this.state;
|
|
const {placeholder} = this.state;
|