5 :placeholder="st.tr['Chat here']"
6 @keyup.enter="sendChat()"
8 button(@click="sendChat()") {{ st.tr["Send"] }}
9 p(v-for="chat in chats.concat(pastChats)")
10 span.name {{ chat.name }} :
12 :class="classObject(chat)"
18 import { store } from "@/store";
21 // Prop 'pastChats' for corr games where chats are on server
22 props: ["players", "pastChats", "newChat"],
26 chats: [] //chat messages after human game
30 newChat: function(chat) {
32 this.chats.unshift({ msg: chat.msg, name: chat.name || "@nonymous" });
36 classObject: function(chat) {
38 "my-chatmsg": chat.name == this.st.user.name,
42 p => p.name == chat.name && p.name != this.st.user.name
46 sendChat: function() {
47 let chatInput = document.getElementById("inputChat");
48 const chatTxt = chatInput.value.trim();
49 if (chatTxt == "") return; //nothing to send
51 const chat = { msg: chatTxt, name: this.st.user.name || "@nonymous" };
52 this.$emit("mychat", chat);
53 this.chats.unshift(chat);
59 <style lang="sass" scoped>