From 69ea40abc00b53a4a84b664fa82c1453bf07c6d1 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Wed, 9 Nov 2022 17:23:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E6=8B=89=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=AE=9A=E4=BD=8D=E9=80=89=E4=B8=AD=E9=A1=B9?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/base/Selection.vue | 10 +++++++++- src/renderer/components/layout/PlayBar/index.vue | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/base/Selection.vue b/src/renderer/components/base/Selection.vue index 164e3d56..f4959ea1 100644 --- a/src/renderer/components/base/Selection.vue +++ b/src/renderer/components/base/Selection.vue @@ -52,10 +52,15 @@ export default { } }, computed: { + activeIndex() { + if (this.modelValue == null) return -1 + if (!this.itemName) return this.list.indexOf(this.modelValue) + return this.list.findIndex(l => l[this.itemKey] == this.modelValue) + }, label() { if (this.modelValue == null) return '' if (this.itemName == null) return this.modelValue - const item = this.list.find(l => l[this.itemKey] == this.modelValue) + const item = this.list[this.activeIndex] if (!item) return '' return item[this.itemName] }, @@ -86,6 +91,9 @@ export default { this.show = true this.$nextTick(() => { this.listStyles.transform = `scaleY(1) translateY(${this.handleGetOffset()}px)` + + const activeItem = this.$refs.dom_list.children[this.activeIndex] + if (activeItem) this.$refs.dom_list.scrollTop = activeItem.offsetTop - this.$refs.dom_list.clientHeight * 0.38 }) }, handleGetOffset() { diff --git a/src/renderer/components/layout/PlayBar/index.vue b/src/renderer/components/layout/PlayBar/index.vue index e090868f..4e529f84 100644 --- a/src/renderer/components/layout/PlayBar/index.vue +++ b/src/renderer/components/layout/PlayBar/index.vue @@ -112,7 +112,7 @@ export default { const title = computed(() => { return musicInfo.name ? appSetting['download.fileName'].replace('歌名', musicInfo.name).replace('歌手', musicInfo.singer) - : '^-^' + : '' }) // onBeforeUnmount(() => {