Skip to content

Commit

Permalink
fix: the lyrics are not displayed properly under the Electron platform
Browse files Browse the repository at this point in the history
  • Loading branch information
Linkontoask committed Nov 28, 2020
1 parent 3f8a71f commit 77fd0af
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/components/process-bar/block.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
> div {
position: absolute;
height: 100%;
Expand Down
4 changes: 2 additions & 2 deletions src/electron/event/ipc-renderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export function sendAsyncIpcRendererEvent(
ipcRenderer.send(action, message)
}

export function sendSyncIpcRendererEvent(
export function sendSyncIpcRendererEvent<T>(
action: ActionType,
message?: Message
) {
): T {
return ipcRenderer.sendSync(action, message)
}

Expand Down
13 changes: 9 additions & 4 deletions src/pages/footer/component/lyrice-flash/browser-lyrice.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { defineComponent, computed, toRefs, watch, toRaw } from 'vue'
import {
defineComponent,
computed,
toRefs,
watch,
toRaw,
watchEffect
} from 'vue'
import { uesModuleStore } from '@/hooks/index'
import { toFixed } from '@/utils/index'
import {
Expand Down Expand Up @@ -89,9 +96,7 @@ export const BrowserLyriceFlash = defineComponent({
})
watch(index, v => {
ipcUpdateLyrice(UpdateType.UPDATE_INDEX, v)
})
watch(lyrice, v => {
ipcUpdateLyrice(UpdateType.UPDATE_LYRICE, v)
ipcUpdateLyrice(UpdateType.UPDATE_LYRICE, lyrice.value)
})
watch(playing, v => {
ipcUpdateLyrice(UpdateType.UPDATE_PLAYING, v)
Expand Down
7 changes: 6 additions & 1 deletion src/pages/footer/component/lyrice-flash/electron-lyrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
UpdateType
} from '@/electron/event/action-types'
import { ErrorBoundary } from '@/components/error-boundary/index'
import { isEqual } from 'lodash'

import { ipcRenderer } from 'electron'

Expand Down Expand Up @@ -63,7 +64,11 @@ export default defineComponent({
postData.index = payload as PostData['index']
break
case UpdateType.UPDATE_LYRICE:
if ((payload as PostData['lyrice']).length !== 0) {
if (
(payload as PostData['lyrice']).length !== 0 &&
!isEqual(payload, postData.lyrice)
) {
console.log(payload)
postData.lyrice = payload as PostData['lyrice']
}
break
Expand Down

0 comments on commit 77fd0af

Please sign in to comment.