From dab334c471b3b9a5c3e9ee1d43fa0899c6f28406 Mon Sep 17 00:00:00 2001 From: fofolee Date: Tue, 3 May 2022 20:34:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=20item=20=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/quickcommandUI/SelectList.vue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/quickcommandUI/SelectList.vue b/src/components/quickcommandUI/SelectList.vue index b33d789..dab6b1c 100644 --- a/src/components/quickcommandUI/SelectList.vue +++ b/src/components/quickcommandUI/SelectList.vue @@ -16,7 +16,9 @@ @mousemove="currentIndex = index" @click="clickOK" manual-focus - :focused="index === currentIndex" + :class="{ + 'item-selected': index === currentIndex, + }" :style="{ height: itemHeight + 'px', paddingRight: shortCutWidth + 'px', @@ -158,7 +160,9 @@ export default { case 13: // 回车 return this.clickOK(); } - this.$refs.scrollBar.scrollTo(this.currentIndex); + this.$nextTick(() => { + document.querySelector(".item-selected").scrollIntoViewIfNeeded(0); + }); }, scrollHandler(e) { @@ -217,5 +221,12 @@ export default { .q-item, .shortcut { user-select: none; + transition: 0s; +} +.item-selected { + background: #dfe2e6; +} +.item-selected.q-item--dark { + background: #515151; }