|
@@ -1,7 +1,7 @@
|
|
import React,{Component} from 'react';
|
|
import React,{Component} from 'react';
|
|
import style from './index.less';
|
|
import style from './index.less';
|
|
import config from "@config/index";
|
|
import config from "@config/index";
|
|
-import {filterArr,handleEnter,isIE} from '@utils/tools.js';
|
|
|
|
|
|
+import {filterArr,isIE} from '@utils/tools.js';
|
|
import Notify from '../Notify/index.js';
|
|
import Notify from '../Notify/index.js';
|
|
|
|
|
|
import $ from 'jquery';
|
|
import $ from 'jquery';
|
|
@@ -111,11 +111,13 @@ class EditableSpan extends Component{
|
|
}
|
|
}
|
|
|
|
|
|
handleKeydown(e){
|
|
handleKeydown(e){
|
|
- let innerVal = e.target.innerText;
|
|
|
|
|
|
+ const ev = e||window.event;
|
|
|
|
+ const target = ev.target||ev.srcElement;
|
|
|
|
+ let innerVal = target.innerText;
|
|
//禁止回车事件
|
|
//禁止回车事件
|
|
- if(e.keyCode==13){return false;}
|
|
|
|
|
|
+ if(ev.keyCode==13){return false;}
|
|
//backspace事件
|
|
//backspace事件
|
|
- if(e.keyCode==8){
|
|
|
|
|
|
+ if(ev.keyCode==8){
|
|
//用于对比backspace前后的值
|
|
//用于对比backspace前后的值
|
|
this.setState({
|
|
this.setState({
|
|
preVal:innerVal
|
|
preVal:innerVal
|
|
@@ -125,9 +127,11 @@ class EditableSpan extends Component{
|
|
}
|
|
}
|
|
handleKeyup(e){
|
|
handleKeyup(e){
|
|
const {boxMark,handleKeydown,i,value} = this.props;
|
|
const {boxMark,handleKeydown,i,value} = this.props;
|
|
- const {preVal,index} = this.state;console.log(22,i,index);
|
|
|
|
- let innerVal = e.target.innerText;
|
|
|
|
- if(e.keyCode==8){
|
|
|
|
|
|
+ const {preVal,index} = this.state;
|
|
|
|
+ const ev = e||window.event;
|
|
|
|
+ const target = ev.target||ev.srcElement;
|
|
|
|
+ let innerVal = target.innerText;
|
|
|
|
+ if(ev.keyCode==8){
|
|
if(innerVal !==preVal){return}
|
|
if(innerVal !==preVal){return}
|
|
let data = innerVal.trim();
|
|
let data = innerVal.trim();
|
|
//判断是否为空、中英文:, 。、;,且不是第一位
|
|
//判断是否为空、中英文:, 。、;,且不是第一位
|