flamenco/web/src/components/ChatMessagebox.vue
Sybren A. Stüvel 96023932da SocketIO based chat client as PoC for backend/frontend communication
The chat client itself is just a throwaway project. The SocketIO system
will be used to send realtime updates about jobs, tasks, and workers to
the web frontend.
2022-02-11 14:47:26 +01:00

39 lines
709 B
Vue

<template>
<b-input-group class="mb-2 mr-sm-2 mb-sm-0">
<b-form-input
placeholder="type here.."
v-model.trim="newMsg"
@keyup.enter="sendMessage"
></b-form-input>
<b-button
size="md"
variant="primary"
class="mb-2"
@click="sendMessage"
:disabled="!newMsg"
>
Send
</b-button>
</b-input-group>
</template>
<script>
export default {
emits: ["sendMessage"],
data() {
return {
newMsg: "",
};
},
methods: {
sendMessage() {
if (!this.newMsg) return;
console.log("emitting message to send:", this.newMsg);
this.$emit("sendMessage", this.newMsg);
this.newMsg = "";
},
},
};
</script>