reset position when reopening emoji picker

This commit is contained in:
Henry Jameson 2019-11-08 21:44:36 +02:00
parent a69946923b
commit 23137dfd4b

View file

@ -109,6 +109,9 @@ const EmojiPicker = {
this.customEmojiBufferSlice += LOAD_EMOJI_BY this.customEmojiBufferSlice += LOAD_EMOJI_BY
}, },
startEmojiLoad (forceUpdate = false) { startEmojiLoad (forceUpdate = false) {
this.$nextTick(() => {
this.$refs['emoji-groups'].scrollTop = 0
})
const bufferSize = this.customEmojiBuffer.length const bufferSize = this.customEmojiBuffer.length
const bufferPrefilledAll = bufferSize === this.filteredEmoji.length const bufferPrefilledAll = bufferSize === this.filteredEmoji.length
if (bufferPrefilledAll && !forceUpdate) { if (bufferPrefilledAll && !forceUpdate) {
@ -126,7 +129,6 @@ const EmojiPicker = {
watch: { watch: {
keyword () { keyword () {
this.customEmojiLoadAllConfirmed = false this.customEmojiLoadAllConfirmed = false
this.$refs['emoji-groups'].scrollTop = 0
this.onScroll() this.onScroll()
this.startEmojiLoad(true) this.startEmojiLoad(true)
} }