We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d05bcaf commit 11b54e8Copy full SHA for 11b54e8
src/views/index/IconsDialog.vue
@@ -19,7 +19,7 @@
19
clearable
20
/>
21
</div>
22
- <ul class="icon-ul">
+ <ul ref="iconWrap" class="icon-ul">
23
<li
24
v-for="icon in iconList"
25
:key="icon"
@@ -61,12 +61,21 @@ export default {
61
onOpen() {
62
this.active = this.current
63
this.key = ''
64
+ this.scrollToActive()
65
},
66
onClose() {},
67
onSelect(icon) {
68
this.active = icon
69
this.$emit('select', icon)
70
this.$emit('update:visible', false)
71
+ },
72
+ scrollToActive() {
73
+ this.$nextTick(() => {
74
+ const $activeItem = this.active
75
+ ? document.getElementsByClassName('active-item')[0]
76
+ : this.$refs.iconWrap.childNodes[0]
77
+ $activeItem && $activeItem.scrollIntoView && $activeItem.scrollIntoView()
78
+ })
79
}
80
81
0 commit comments