Bladeren bron

单选多选双击编辑蓝框2598

zhouna 5 jaren geleden
bovenliggende
commit
80aa4efc9a
2 gewijzigde bestanden met toevoegingen van 8 en 3 verwijderingen
  1. 6 2
      src/components/Multiple/index.jsx
  2. 2 1
      src/components/RadioDrop/index.jsx

+ 6 - 2
src/components/Multiple/index.jsx

@@ -40,13 +40,14 @@ class Multiple extends react.Component{
     const {show,value,hideTag,isImports,isExtBlue} = this.props;
     const orgBorder = isImports&&!value?style['orange-border']:'';
     const ext = isExtBlue?style['ext']:'';
+    const editBorder = this.state.editable?style['blue-border']:'';
     if(show){
       $(this.$div.current).addClass(style['borderd']);
     }else{
       $(this.$div.current).removeClass(style['borderd']);
     }
     if(value){
-      return hideTag?classNames(style['hide-tag'],orgBorder):classNames(style['selected-tag'],orgBorder);
+      return hideTag?classNames(style['hide-tag'],orgBorder):classNames(style['selected-tag'],orgBorder,editBorder);
     }
     return hideTag?'':classNames(style['tag'],orgBorder,ext);
   }
@@ -84,6 +85,7 @@ class Multiple extends react.Component{
   changeToEdit(e){//双击
     const {value,id,placeholder,handleDbclick,handleHide} = this.props;
     let text = e.target.innerText || e.target.innerHTML;
+    window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();
     handleHide&&handleHide();       //展开情况下双击收起
     // clearTimeout(this.state.timer);//取消延时的单击事件
     e.stopPropagation();
@@ -92,7 +94,9 @@ class Multiple extends react.Component{
         labelVal:text,
         editable:true
       });
-      e.target.focus();
+      /*setTimeout(()=>{
+        e.target.focus();
+      })*/
       handleDbclick && handleDbclick({value,id,placeholder});
     }
   }

+ 2 - 1
src/components/RadioDrop/index.jsx

@@ -37,6 +37,7 @@ class RadioDrop extends Component{
     const {value,hideTag,show,isImports,isExtBlue} = this.props;
     const ext = isExtBlue?style['ext']:'';
     const orgBorder = isImports?style['orange-border']:'';      //橙色框高亮
+    const editBorder = this.state.editable?style['blue-border']:'';
     if(show){
       $(this.$cont.current).addClass(style['borderd']);
     }else{
@@ -46,7 +47,7 @@ class RadioDrop extends Component{
       return classNames(style['no-tag'],ext);
     }
     if(value){
-      return style['selected-tag'];
+      return classNames(style['selected-tag'],editBorder);
     }
     return classNames(style['tag'],orgBorder,ext);
   }