Fix error on emoji picker first load

Ref: grouped-emoji-picker
This commit is contained in:
Tusooa Zhu 2021-10-08 15:47:39 -04:00
parent d648a6f8dc
commit c93da0b865
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224

View file

@ -133,6 +133,18 @@ const EmojiPicker = {
this.$lozad.mutationObserver.disconnect()
}
}
},
onShowing () {
const oldContentLoaded = this.contentLoaded
this.contentLoaded = true
this.waitForDomAndInitializeLazyLoad()
if (!oldContentLoaded) {
this.$nextTick(() => {
if (this.defaultGroup) {
this.highlight(this.defaultGroup)
}
})
}
}
},
watch: {
@ -145,16 +157,14 @@ const EmojiPicker = {
},
showing (val) {
if (val) {
this.contentLoaded = true
this.waitForDomAndInitializeLazyLoad()
this.onShowing()
}
}
},
mounted () {
if (this.defaultGroup) {
this.highlight(this.defaultGroup)
if (this.showing) {
this.onShowing()
}
this.waitForDomAndInitializeLazyLoad()
},
destroyed () {
this.destroyLazyLoad()