1. I made a simulated Wechat chat window, Firefox will have the following problems when sending chat messages: Chinese input such as pinyin: nihao, presses the enter key to send nihao directly to the chat window; while chrome browser presses enter to display nihao in the input box and then press enter again to send it to the chat window.
2. The front-end code is as follows:
<el-input class="chat-input"
type="textarea"
:rows="4"
resize="none"
placeholder="..."
@keyup.enter.native="submitChat"
v-model="chatInput"></el-input>
<el-button class="btn-enter" size="small" type="primary" @click="submitChat"></el-button>
3. Baidu said to replace keyup with keydown ( https://www.jb51.net/article/.). It is true that I will not send Pinyin directly after I try to change it to keydown, but the value chatInput bound to the input box cannot be cleared when I press enter again. After the message is sent out, the content of the input box changes the line:
:
:
4. If you send a message through the enter key, chrome and Google will flash the cursor to wrap the line and then send it to the chat window. Clicking the send button to trigger the submitChat () method does not have this phenomenon. I compared the Wechat web version in both browsers. Turn to God for help to solve this problem. Thank you
.