Fix double input submit
This commit is contained in:
parent
084e01cf46
commit
0a774758b9
@ -93,6 +93,19 @@ export default {
|
|||||||
network: Object,
|
network: Object,
|
||||||
channel: Object,
|
channel: Object,
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
"channel.messages"() {
|
||||||
|
const el = this.$refs.chat;
|
||||||
|
|
||||||
|
if (el.scrollHeight - el.scrollTop - el.offsetHeight > 30) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
el.scrollTop = el.scrollHeight;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
if (window.IntersectionObserver) {
|
if (window.IntersectionObserver) {
|
||||||
this.historyObserver = new window.IntersectionObserver(loadMoreHistory, {
|
this.historyObserver = new window.IntersectionObserver(loadMoreHistory, {
|
||||||
@ -114,19 +127,6 @@ export default {
|
|||||||
this.historyObserver.disconnect();
|
this.historyObserver.disconnect();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
"channel.messages": function() {
|
|
||||||
const el = this.$refs.chat;
|
|
||||||
|
|
||||||
if (el.scrollHeight - el.scrollTop - el.offsetHeight > 30) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
|
||||||
el.scrollTop = el.scrollHeight;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
onShowMoreClick() {
|
onShowMoreClick() {
|
||||||
let lastMessage = this.channel.messages[0];
|
let lastMessage = this.channel.messages[0];
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
:aria-label="getInputPlaceholder(channel)"
|
:aria-label="getInputPlaceholder(channel)"
|
||||||
:disabled="!$root.connected"
|
:disabled="!$root.connected"
|
||||||
class="mousetrap"
|
class="mousetrap"
|
||||||
@keyup.enter="onSubmit"
|
@keypress.enter.prevent="onSubmit"
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
v-if="$root.connected"
|
v-if="$root.connected"
|
||||||
|
Loading…
Reference in New Issue
Block a user