wangwei 4 роки тому
батько
коміт
14d8af0dbe
1 змінених файлів з 3 додано та 3 видалено
  1. 3 3
      src/components/ChatFrame.vue

+ 3 - 3
src/components/ChatFrame.vue

@@ -84,7 +84,7 @@
               <div
                 class="message-content-text"
                 v-if="item.type === 'text'"
-                v-text="_parseText(item.msg)"
+                v-html="_parseText(item.msg)"
               ></div>
               <!-- 图片 -->
               <div
@@ -424,9 +424,9 @@ export default {
       const regex2 = /\[(.+?)\]/g;
       const codeList = text.match(regex2)
       console.log('[]',text.match(regex2))
-      let html = null
+      let html = text
       codeList.map((item,i) => {
-        html = text.replace(item, "<img style='width: 20px; height: 20px;vertical-align: sub;' src='" +
+        html = html.replace('/' + item +'/g', "<img style='width: 20px; height: 20px;vertical-align: sub;' src='" +
         this.getIconPic(item) +
         "' unicode = '" +
         item +