el-input 框回车不换行
时间: 2023-10-08 15:04:48 浏览: 717
el-input 框回车不换行的问题可以通过添加事件 @keydown.enter.native.prevent 解决。在输入框上添加这个事件后,当按下回车键时,不会换行,而是执行其他操作。 例如,在给消息添加换行符的方法中,可以使用 e.preventDefault() 来阻止默认的换行行为,从而实现回车不换行的效果。这样,无论是按下 Enter 键还是组合键 Ctrl + Enter 键,都不会触发换行。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [enter键控制input光标移动到下一个框](https://download.csdn.net/download/alice_666/10740494)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [el-input,textarea回车键不换行,发送消息](https://blog.csdn.net/Cool_so_cool/article/details/111050230)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [el-input发送消息空格、换行问题](https://blog.csdn.net/weixin_48414904/article/details/129498846)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文