main/view/vue/container/inbox.vue

35 lines
754 B
Vue

<template>
<div id='CONTAINER' class='message'>
<div v-for='msg in gstore.notif[1].data' :class="msg[0] == gstore.server.session.name ? 'me' : ''">
<span class='author'>{{ msg[0] }}</span>
<span class='content'>{{ msg[1] }}</span>
</div>
<form class='msg-input' @submit.prevent='new_message'>
<input type='text' placeholder='Nouveau message..' id='msg-new-content' v-model='gstore.new_msg'>
<button></button>
</form>
</div>
</template>
<script>
export default {
name: 'CONTAINER_INBOX',
data(){ return { gstore: window.gstore.data }; },
methods: {
new_message(msg){
// {1} Send message //
this.gstore.func.sendMessage(this.gstore.new_msg);
// {2} Empty input //
this.gstore.new_msg = '';
}
}
}
</script>