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> <template>
<div class="write"> <div class="write">
<div class="write__content"> <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 <button
:disabled="CheckerforBtn()" :disabled="CheckerforBtn()"
type="submit" type="submit"
@@ -27,6 +27,11 @@ export default {
CheckerforBtn() { CheckerforBtn() {
return this.msg === '' return this.msg === ''
}, },
sendmsgDataEnter() {
if (this.msg !== '') {
this.SendmsgData()
}
},
SendmsgData() { SendmsgData() {
this.$emit('send', [this.msg, this.username, this.icon]) this.$emit('send', [this.msg, this.username, this.icon])
this.msg = '' this.msg = ''