Procházet zdrojové kódy

data正则清除,回车发送消息

liuQiang před 1 rokem
rodič
revize
d6781bd823
1 změnil soubory, kde provedl 2 přidání a 5 odebrání
  1. 2 5
      src/layout/components/AIPage/AIPage.vue

+ 2 - 5
src/layout/components/AIPage/AIPage.vue

@@ -42,6 +42,7 @@
           :autosize="{ minRows: 2, maxRows: 5 }"
           type="textarea"
           placeholder="请在此输入关键词"
+          @keyup.enter="enterChat"
         />
         <div class="chatBtn">
           <img :src="send" class="send-info" @click="enterChat" />
@@ -118,12 +119,8 @@ const enterChat = () => {
         const message = decoder.decode(value);
         // console.log("原:", message);
         let newMsg = message
-          .replace("data:", "")
+          .replace(/data:/gi, "")
           .replace("\n", "")
-          .replace("\n", "")
-          .replace("data:", "")
-          .replace("\n", "")
-          .replace("data:", "");
         // console.log("改:", newMsg);
         let v = resultData.value.replace("\n", "") + newMsg.replace("\n", "");
         resultData.value = v;