
vue3 textarea 自动控制高度,enter键发送,shift+enter换行
vue
vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
项目地址:https://gitcode.com/gh_mirrors/vu/vue

·
<el-input
v-model="emojisOutput"
:autosize="{ minRows: 2, maxRows: 4 }"
placeholder="请输入内容"
type="textarea"
@keydown.enter="send_ready" />
//发送
const send_ready = (event)=>{
// 是否按下enter键
console.log(event)
if (event.keyCode == 13) {
if (!event.shiftKey) {
//只有enter没有shift,或进行你的其他逻辑
event.preventDefault();// 阻止默认行为,即不换行
console.log('发送')
}
}
}




vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
最近提交(Master分支:6 个月前 )
9e887079
[skip ci] 4 个月前
73486cb5
* chore: fix link broken
Signed-off-by: snoppy <michaleli@foxmail.com>
* Update packages/template-compiler/README.md [skip ci]
---------
Signed-off-by: snoppy <michaleli@foxmail.com>
Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com> 8 个月前
更多推荐
所有评论(0)