From 093faac718c65aeb5a22ed5d57f3ab3e52cfe0d2 Mon Sep 17 00:00:00 2001 From: Link Date: Sun, 29 Aug 2021 13:13:09 +0800 Subject: [PATCH] fix: flash lyric update --- src/hooks/http.ts | 2 +- src/interface/app.ts | 3 +++ src/pages/footer/components/music-controller/index.tsx | 2 +- src/pages/setting/sage.ts | 2 +- src/store/index.ts | 1 + src/types.d.ts | 7 ++++++- tsconfig.json | 2 +- 7 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/hooks/http.ts b/src/hooks/http.ts index 25b0567a..7b2b2e21 100644 --- a/src/hooks/http.ts +++ b/src/hooks/http.ts @@ -1,5 +1,5 @@ import { reactive } from 'vue' -// 有时间去迁移一下到axios + export const useHttp = (fetchFn: Function): any => { const state = reactive({ loading: false diff --git a/src/interface/app.ts b/src/interface/app.ts index 45409b22..31438d0d 100644 --- a/src/interface/app.ts +++ b/src/interface/app.ts @@ -1,5 +1,6 @@ import { ComponentPublicInstance, App } from 'vue' import { FooterMutations, RecommendMutations } from '@/interface' +import language from '@/locale/zh-cn.json' export interface Music extends ComponentPublicInstance { $app: App @@ -66,3 +67,5 @@ export type SongListColumnsType = | 'dlt' export type AllMutations = FooterMutations & RecommendMutations + +export type LanguageKey = typeof language diff --git a/src/pages/footer/components/music-controller/index.tsx b/src/pages/footer/components/music-controller/index.tsx index a608925a..f46dad02 100644 --- a/src/pages/footer/components/music-controller/index.tsx +++ b/src/pages/footer/components/music-controller/index.tsx @@ -195,7 +195,7 @@ export const MusicControl = defineComponent({ audioElement.value.currentTime ) } - requestAnimationFrame(timeUpdate) + setTimeout(timeUpdate, 0) } watch( diff --git a/src/pages/setting/sage.ts b/src/pages/setting/sage.ts index 06867da8..07b1f671 100644 --- a/src/pages/setting/sage.ts +++ b/src/pages/setting/sage.ts @@ -36,7 +36,7 @@ export const mutations: MutationTree = { [SettingMutations.SET_CONVOLVER_EFFECT](state, convolver) { const { useState } = useFooterModule() const footerState = useState() - if (convolver === $t('src__pages__setting__sage___37')) { + if (convolver === '原唱') { footerState.effect?.clearConvolver() } else { footerState.effect?.createConvolver(convolver) diff --git a/src/store/index.ts b/src/store/index.ts index e8663d0f..8cdf98bf 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -136,6 +136,7 @@ plugins.push( 'Footer.musicLyricsOrigin', 'Footer.currentTime', 'Footer.visibleLyrics', + 'Footer.playMode', 'Setting', 'Download', 'LocalMusic' diff --git a/src/types.d.ts b/src/types.d.ts index ee83efef..777b5060 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,6 +1,7 @@ import { ComponentCustomProperties } from 'vue' import { Store } from 'vuex' import { RootState } from '@/store/index' +import { LanguageKey } from './interface' declare module '@vue/runtime-core' { interface ComponentCustomProperties { @@ -26,7 +27,11 @@ declare global { declare const MediaMetadata: MediaMetadataType - declare const $t: (key: string, ...args: any[]) => string + declare const $t: ( + key: T, + ...args: any[] + ) => LanguageKey[T] + interface Window { isMobile: boolean webkitAudioContext: AudioContext diff --git a/tsconfig.json b/tsconfig.json index 7a770288..8d9922d5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,7 @@ "@/*": ["src/*"], "root/*": ["./*"], }, - "lib": ["esnext", "dom", "dom.iterable", "scripthost"] + "lib": ["esnext", "dom", "dom.iterable", "scripthost", "es2019"] }, "include": [ "src/**/*.ts",