Browse Source

模板字符串替换Html标签

zhangxc 6 years ago
parent
commit
199d21c544
2 changed files with 3 additions and 2 deletions
  1. 1 1
      src/components/Advice/Textarea/index.jsx
  2. 2 1
      src/store/actions/pushMessage.js

+ 1 - 1
src/components/Advice/Textarea/index.jsx

@@ -18,7 +18,7 @@ class Textarea extends Component {
   handleInput(e){
     e.stopPropagation();
     const {handleChangeAssistValue,idx,handlePush} = this.props;
-    const text = e.target.innerText || e.target.innerHTML;
+    const text =  e.target.innerHTML;
     const stimer = this.state.timer;
     handleChangeAssistValue&&handleChangeAssistValue(text);
    

+ 2 - 1
src/store/actions/pushMessage.js

@@ -73,7 +73,8 @@ function getAdviceStr(advice) {
 	if(adviceInput)  { 
 		AdviceStr = AdviceStr +'; ' + adviceInput;
 	}	
-	
+	let reg=/<[^>]+>/gim;
+	AdviceStr = AdviceStr.replace(reg,"");
 	return AdviceStr;
 }