<template lang="pug">
-.row
- .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
- // TODO: Chat modal sur petit écran, dans la page pour grand écran
- .card.smallpad
- h4 Chat
- p(v-for="chat in chats" :class="classObject(chat)" v-html="chat.msg")
- input#inputChat(type="text" :placeholder="st.tr['Type here']"
- @keyup.enter="sendChat")
- button#sendChatBtn(@click="sendChat") {{ st.tr["Send"] }}
+.card
+ input#inputChat(type="text" :placeholder="st.tr['Type here']"
+ @keyup.enter="sendChat")
+ button#sendChatBtn(@click="sendChat") {{ st.tr["Send"] }}
+ p(v-for="chat in chats" :class="classObject(chat)" v-html="chat.msg")
</template>
<script>
const data = JSON.parse(msg.data);
if (data.code == "newchat") //only event at this level
{
- this.chats.push({msg:data.msg,
+ this.chats.unshift({msg:data.msg,
name:data.name || "@nonymous", sid:data.from});
}
};
chatInput.value = "";
const chat = {msg:chatTxt, name: this.st.user.name || "@nonymous",
sid:this.st.user.sid};
- this.chats.push(chat);
+ this.chats.unshift(chat);
this.st.conn.send(JSON.stringify({
code:"newchat", msg:chatTxt, name:chat.name}));
},
};
</script>
-<style lang="sass">
+<style lang="sass" scoped>
.my-chatmsg
color: grey
.opp-chatmsg
color: black
+#chat
+ max-width: 100%
</style>