Skip to content

Commit 0658d84

Browse files
committed
Fix scroll to the bottom when sending/receiving a message
1 parent 487cdac commit 0658d84

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## [0.0.6] - 2018-10-15
4+
- Fix scroll to the bottom when sending/receiving a message.
5+
6+
37
## [0.0.5] - 2018-10-12
48
- Fix when sending/receiving a message, scroll to the bottom.
59
- Fix ensure use of boolean types in order to support PostgreSQL.

publishable/public/js/mercurius.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/messages/Messages.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,12 @@ export default {
162162
if (!this._hasMsg(idx+1)) return false;
163163
return (this.messages[idx+1].sender_id === msg.sender_id);
164164
},
165-
_scrollTo(scroll_y) {
166-
setTimeout(() => {
167-
this.$refs.wrap.scrollTo({x: 0, y: scroll_y+'%'}, false)
168-
}, 300);
165+
_scrollTo(y_val) {
166+
this.$refs.wrap.scrollTo({x: 0, y: y_val})
169167
},
170168
_appendMsg(msg) {
171169
this.messages.unshift(msg)
172-
this._scrollTo(100)
170+
this._scrollTo('100%')
173171
},
174172
175173
@@ -183,13 +181,13 @@ export default {
183181
},
184182
onLoadMessages(usr) {
185183
this.loadMessagesStart(usr.id)
186-
.then(() => this._scrollTo(100));
184+
.then(() => this._scrollTo('100%'));
187185
},
188186
onScroll(barY, barX, e) {
189187
if (barY.scrollTop > 20 || this.offset < 0) return false;
190188
191189
this.loadMessages()
192-
.then(() => this._scrollTo(25));
190+
.then(() => this._scrollTo('25%'));
193191
},
194192
}
195193
}

0 commit comments

Comments
 (0)