Sfoglia il codice sorgente

机器人文字换行

@dongkboy 2 anni fa
parent
commit
b6d413c78b
1 ha cambiato i file con 7 aggiunte e 3 eliminazioni
  1. 7 3
      src/components/customerService/modalDialog.vue

+ 7 - 3
src/components/customerService/modalDialog.vue

@@ -8,12 +8,12 @@
             <div class="flex f-c j-c" v-for="(item, index) in msgList" :key="index">
               <div class="flex f-c " v-if="!item.my">
                 <div class="flex j-c a-c">
-                  <span class="initTime flex j-c a-c">{{ item.initTime }}</span>
+                  <span class="initTime flex j-c a-c"> {{ item.initTime }}</span>
                 </div>
                 <div style="max-width: 350px;" class="flex">
                   <div class="conversationText flex j-s a-c">
                     <img v-if="index == 0" src="../../assets/customerService/customerService1.png" alt="">
-                    <span :style="{ marginLeft: index === 0 ? '60px' : '10px' }">{{ item.msg }}</span>
+                    <span :style="{ marginLeft: index === 0 ? '60px' : '10px' }">{{ item.msg }} </span>
                   </div>
                 </div>
               </div>
@@ -144,7 +144,7 @@ export default {
           messageObj.msg += text.charAt(index);
           index++;
           setTimeout(addCharacter, speed);
-        }else{
+        } else {
           this.msgGo();
         }
       };
@@ -218,7 +218,9 @@ export default {
       margin-bottom: 18px;
       position: relative;
       padding: 8px;
+      white-space: pre-wrap;
 
+      /* 保留换行符和空格 */
       span {
 
         font-size: 14px;
@@ -241,7 +243,9 @@ export default {
       border-radius: 4px;
       padding: 8px;
       margin-bottom: 18px;
+      white-space: pre-wrap;
 
+      /* 保留换行符和空格 */
       span {
         color: #FFFFFF;
         font-size: 14px;