upd: vue.container.inbox (fix submit trigger)

This commit is contained in:
xdrm-brackets 2017-12-07 20:11:28 +01:00
parent 037057cc8a
commit 8a649dbf0b
1 changed files with 12 additions and 4 deletions

View File

@ -9,7 +9,7 @@
<div class='end-pad'></div> <!-- End Spacing --> <div class='end-pad'></div> <!-- End Spacing -->
<form class='msg-input' @submit.prevent='new_message'> <form class='msg-input' @submit.prevent='new_message(gstore.new_msg.emergency)'>
<input type='text' placeholder='Nouveau message..' id='msg-new-content' v-model='gstore.new_msg.inbox' :class='gstore.msg_pending.inbox ? "loading" : ""'> <input type='text' placeholder='Nouveau message..' id='msg-new-content' v-model='gstore.new_msg.inbox' :class='gstore.msg_pending.inbox ? "loading" : ""'>
<button></button> <button></button>
</form> </form>
@ -27,11 +27,19 @@ export default {
methods: { methods: {
new_message(msg){ new_message(msg){
// {1} Send message // /* (1) If empty message -> abort */
this.gstore.func.sendMessage(this.gstore.new_msg.inbox, wsc_chat); if( msg.trim().length == 0 )
return;
// {2} Empty input // /* (2) Send message to WebSocket */
wsc_chat.send(JSON.stringify({message: msg}));
/* (3) Add loader */
gstore.data.msg_pending.inbox = true;
/* (4) Empty input */
this.gstore.new_msg.inbox = ''; this.gstore.new_msg.inbox = '';
}, },
bbcode: function(msg){ bbcode: function(msg){