Avoid title reseting mid modification
This commit is contained in:
parent
7ca5c34afe
commit
b049c46571
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
const msgContent = ref("");
|
const msgContent = ref("");
|
||||||
const addMember = ref(false);
|
const addMember = ref(false);
|
||||||
|
const currentTitle = ref("");
|
||||||
|
|
||||||
function formatTime(date){
|
function formatTime(date){
|
||||||
return date.getHours() + ":" + date.getMinutes() + " " + date.getDate() + "/" + date.getMonth();
|
return date.getHours() + ":" + date.getMinutes() + " " + date.getDate() + "/" + date.getMonth();
|
||||||
@ -21,11 +22,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="msg">
|
<div id="msg">
|
||||||
<div id="discList">
|
<div id="discList">
|
||||||
<div @click="fetchDiscussion(discussion.id)" class="discItem" v-for="discussion in discussionsList" :key="discussion.id">{{ discussion.name }}</div>
|
<div @click="fetchDiscussion(discussion.id).then(e => currentTitle = currentDiscussion.name)" class="discItem" v-for="discussion in discussionsList" :key="discussion.id">{{ discussion.name }}</div>
|
||||||
<button id="createDiscussion" @click="createDiscussion('New Discussion')">+</button>
|
<button id="createDiscussion" @click="createDiscussion('New Discussion')">+</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="discussion" v-if="currentDiscussion.length != 0">
|
<div id="discussion" v-if="currentDiscussion.length != 0">
|
||||||
<h1 id=msgName ><input class="InputTitle" type="text" @change="updateDiscussionName(currentDiscussion.id, currentDiscussion.name)" v-model="currentDiscussion.name"></h1>
|
<h1 id=msgName ><input class="InputTitle" type="text" @change="updateDiscussionName(currentDiscussion.id, currentTitle)" v-model="currentTitle"></h1>
|
||||||
<div id=msgs>
|
<div id=msgs>
|
||||||
<div class="msg" v-for="msg in currentDiscussion.msgs" :sender="msg.sender" :key="msg.id">
|
<div class="msg" v-for="msg in currentDiscussion.msgs" :sender="msg.sender" :key="msg.id">
|
||||||
{{ msg.content }}<br/>
|
{{ msg.content }}<br/>
|
||||||
@ -33,8 +34,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id=messageBox>
|
<div id=messageBox>
|
||||||
<input type="text" v-model="msgContent">
|
<input type="text" @keyup.enter="sendMessage(currentDiscussion.id, msgContent, null); msgContent = ''" v-model="msgContent">
|
||||||
<input type="submit" @click="sendMessage(currentDiscussion.id, msgContent, null)" value="send">
|
<input type="submit" @click="sendMessage(currentDiscussion.id, msgContent, null); msgContent = ''" value="send">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="members" v-if="currentDiscussion.length != 0">
|
<div id="members" v-if="currentDiscussion.length != 0">
|
||||||
|
Loading…
Reference in New Issue
Block a user