projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
A few fixes
[vchess.git]
/
client
/
src
/
components
/
Chat.vue
diff --git
a/client/src/components/Chat.vue
b/client/src/components/Chat.vue
index
f1e1fad
..
510acdd
100644
(file)
--- a/
client/src/components/Chat.vue
+++ b/
client/src/components/Chat.vue
@@
-1,5
+1,7
@@
<template lang="pug">
div
<template lang="pug">
div
+ button(@click="clearHistory()")
+ | {{ st.tr["Clear history"] }}
input#inputChat(
type="text"
:placeholder="st.tr['Chat here']"
input#inputChat(
type="text"
:placeholder="st.tr['Chat here']"
@@
-19,19
+21,13
@@
import { store } from "@/store";
export default {
name: "my-chat",
// Prop 'pastChats' for corr games where chats are on server
export default {
name: "my-chat",
// Prop 'pastChats' for corr games where chats are on server
- props: ["players", "pastChats"
, "newChat"
],
+ props: ["players", "pastChats"],
data: function() {
return {
st: store.state,
chats: [] //chat messages after human game
};
},
data: function() {
return {
st: store.state,
chats: [] //chat messages after human game
};
},
- watch: {
- newChat: function(chat) {
- if (chat.msg != "")
- this.chats.unshift({ msg: chat.msg, name: chat.name || "@nonymous" });
- }
- },
methods: {
classObject: function(chat) {
return {
methods: {
classObject: function(chat) {
return {
@@
-51,6
+47,14
@@
export default {
const chat = { msg: chatTxt, name: this.st.user.name || "@nonymous" };
this.$emit("mychat", chat);
this.chats.unshift(chat);
const chat = { msg: chatTxt, name: this.st.user.name || "@nonymous" };
this.$emit("mychat", chat);
this.chats.unshift(chat);
+ },
+ newChat: function(chat) {
+ if (chat.msg != "")
+ this.chats.unshift({ msg: chat.msg, name: chat.name || "@nonymous" });
+ },
+ clearHistory: function() {
+ this.chats = [];
+ this.$emit("chatcleared");
}
}
};
}
}
};