diff options
| author | Tusooa Zhu <tusooa@kazv.moe> | 2021-10-08 15:47:39 -0400 |
|---|---|---|
| committer | Tusooa Zhu <tusooa@kazv.moe> | 2022-09-18 13:19:52 -0400 |
| commit | c93da0b865e9a14c6fa952e63c4c4f77f34943bc (patch) | |
| tree | 39820f259921b46217972f2067e01eee87b7c442 | |
| parent | d648a6f8dc37a2ceb851f1cecde34fd6c54d7d1f (diff) | |
Fix error on emoji picker first load
Ref: grouped-emoji-picker
| -rw-r--r-- | src/components/emoji_picker/emoji_picker.js | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index aeee867d..ea53a972 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -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() |
