1.qq表情替换收到这样一个字符串,通过正则化匹配每组方括号然后替换var_str=i.content.replace(/\[.{1,3}\]/g,(str)=>{//i.content为遍历的消息记录varindex;Object.keys(faceCode).forEach((key,_index)=>{//faceCode是字符串和样式的关系,也可以通过后台约定参数。你不需要像这样搜索if(key===str){index=_index;}});if(index){varhtml=`

1.qq表情替换收到这样一个字符串,通过正则化匹配每组方括号然后替换var_str=i.content.replace(/\[.{1,3}\]/g,(str)=>{//i.content为遍历的消息记录varindex;Object.keys(faceCode).forEach((key,_index)=>{//faceCode是字符串和样式的关系,也可以通过后台约定参数。你不需要像这样搜索if(key===str){index=_index;}});if(index){varhtml=`