added listener on click enter, chatcomponent - writechatcomponent

This commit is contained in:
Kostya
2023-12-06 12:35:45 +03:00
parent 6285eef3ed
commit e5038e89c3

View File

@@ -1,7 +1,7 @@
<template>
<div class="write">
<div class="write__content">
<input type="text" v-model.trim="msg" placeholder="Напишите сообщение..." maxlength="22">
<input type="text" @keyup.enter="sendmsgDataEnter" v-model.trim="msg" placeholder="Напишите сообщение..." maxlength="22">
<button
:disabled="CheckerforBtn()"
type="submit"
@@ -27,6 +27,11 @@ export default {
CheckerforBtn() {
return this.msg === ''
},
sendmsgDataEnter() {
if (this.msg !== '') {
this.SendmsgData()
}
},
SendmsgData() {
this.$emit('send', [this.msg, this.username, this.icon])
this.msg = ''