更新依赖版本,优化组件逻辑

This commit is contained in:
lyswhut
2025-08-09 18:07:16 +08:00
parent 8a8c8a5699
commit ffa979ddc8
5 changed files with 31 additions and 15 deletions
@@ -270,9 +270,15 @@ export default {
cachedList = Array(list.length)
startIndex = -1
endIndex = -1
void nextTick(() => {
updateView()
})
if (cachedList.length) {
void nextTick(() => {
requestAnimationFrame(() => {
updateView()
})
})
} else {
views.value = []
}
}
watch(() => props.itemHeight, () => {
handleReset(props.list)
@@ -289,7 +295,15 @@ export default {
cachedList = Array(props.list.length)
startIndex = -1
endIndex = -1
updateView()
if (props.list.length) {
void nextTick(() => {
requestAnimationFrame(() => {
console.log('updateView')
updateView()
})
})
}
window.addEventListener('resize', handleResize)
})
onBeforeUnmount(() => {
@@ -11,8 +11,8 @@ material-modal(:show="modelValue" teleport="#view" @close="handleCloseModal" @af
div(:class="[$style.row, $style.tip, { [$style.show]: !!timeLabel }]")
p {{ $t('play_timeout_tip', { time: timeLabel }) }}
div(:class="$style.footer")
base-btn(:class="$style.footerBtn" @click="handleCancel") {{ $t(timeLabel ? 'play_timeout_stop' : 'play_timeout_close') }}
base-btn(:class="$style.footerBtn" @click="handleConfirm") {{ $t(timeLabel ? 'play_timeout_update' : 'play_timeout_confirm') }}
base-btn(:class="$style.footerBtn" @click="handleCancel") {{ $t(timeLabel ? 'play_timeout_stop' : 'play_timeout_close') }}
base-btn(:class="$style.footerBtn" @click="handleConfirm") {{ $t(timeLabel ? 'play_timeout_update' : 'play_timeout_confirm') }}
</template>
<script>
@@ -47,6 +47,8 @@ dd
base-checkbox(id="setting_download_isEmbedLyricT" :disabled="!appSetting['download.isEmbedLyric']" :model-value="appSetting['download.isEmbedLyricT']" :label="$t('setting__download_embed_tlyric')" @update:model-value="updateSetting({'download.isEmbedLyricT': $event})")
.gap-top
base-checkbox(id="setting_download_isEmbedLyricR" :disabled="!appSetting['download.isEmbedLyric']" :model-value="appSetting['download.isEmbedLyricR']" :label="$t('setting__download_embed_rlyric')" @update:model-value="updateSetting({'download.isEmbedLyricR': $event})")
.gap-top
base-checkbox(id="setting_download_isEmbedLyricLx" :disabled="!appSetting['download.isEmbedLyric']" :model-value="appSetting['download.isEmbedLyricLx']" :label="$t('setting__download_embed_lxlyric')" @update:model-value="updateSetting({'download.isEmbedLyricLx': $event})")
dd(:aria-label="$t('setting__download_lyric_title')")
h3#download_lyric {{ $t('setting__download_lyric') }}
.gap-top
@@ -55,6 +57,8 @@ dd(:aria-label="$t('setting__download_lyric_title')")
base-checkbox(id="setting_download_isDownloadTLrc" :disabled="!appSetting['download.isDownloadLrc']" :model-value="appSetting['download.isDownloadTLrc']" :label="$t('setting__download_tlyric')" @update:model-value="updateSetting({'download.isDownloadTLrc': $event})")
.gap-top
base-checkbox(id="setting_download_isDownloadRLrc" :disabled="!appSetting['download.isDownloadLrc']" :model-value="appSetting['download.isDownloadRLrc']" :label="$t('setting__download_rlyric')" @update:model-value="updateSetting({'download.isDownloadRLrc': $event})")
.gap-top
base-checkbox(id="setting_download_isDownloadLxLrc" :disabled="!appSetting['download.isDownloadLrc']" :model-value="appSetting['download.isDownloadLxLrc']" :label="$t('setting__download_lxlyric')" @update:model-value="updateSetting({'download.isDownloadLxLrc': $event})")
dd
h3#download_lyric_format
| {{ $t('setting__download_lyric_format') }}
@@ -36,7 +36,7 @@ import { openUrl } from '@common/utils/electron'
import apiSourceInfo from '@renderer/utils/musicSdk/api-source-info'
import { userApi } from '@renderer/store'
import { appSetting, updateSetting } from '@renderer/store/setting'
import { ref } from '@common/utils/vueTools'
import { computed, ref } from '@common/utils/vueTools'
import { dialog } from '@renderer/plugins/Dialog'
import UserApiOnlineImportModal from './UserApiOnlineImportModal.vue'
@@ -54,17 +54,15 @@ export default {
emits: ['update:modelValue'],
setup() {
const isShowOnlineImportModal = ref(false)
const apiList = computed(() => userApi.list)
return {
userApi,
apiList,
appSetting,
isShowOnlineImportModal,
}
},
computed: {
apiList() {
return this.userApi.list
},
},
methods: {
async importUserApi(script) {
return importUserApi(script).then(({ apiList }) => {