修复关闭“显示切换动画”设置后,在应用启动时该设置没有被应用的问题

pull/930/merge
lyswhut 2022-05-05 16:02:09 +08:00
parent c758066e25
commit 8ab1bdf30a
3 changed files with 33 additions and 31 deletions

View File

@ -6,3 +6,4 @@
### 修复
- 修复某些情况下歌曲播放出错时不会自动切歌的问题
- 修复关闭“显示切换动画”设置后,在应用启动时该设置没有被应用的问题

View File

@ -14,41 +14,13 @@
</template>
<script>
import { useRefGetter, watch, onMounted } from '@renderer/utils/vueTools'
import { onMounted } from '@renderer/utils/vueTools'
import useApp from '@renderer/core/useApp'
import { isFullscreen } from '@renderer/core/share'
import { getFontSizeWithScreen } from '@renderer/utils'
export default {
setup() {
const theme = useRefGetter('theme')
const font = useRefGetter('font')
const windowSizeActive = useRefGetter('windowSizeActive')
const dom_root = document.getElementById('root')
watch(theme, (val) => {
dom_root.className = val
})
watch(font, (val) => {
document.documentElement.style.fontFamily = val
}, {
immediate: true,
})
watch(isFullscreen, val => {
if (val) {
document.body.classList.remove(window.dt ? 'disableTransparent' : 'transparent')
document.body.classList.add('fullscreen')
document.documentElement.style.fontSize = getFontSizeWithScreen(window.screen.width) + 'px'
} else {
document.body.classList.remove('fullscreen')
document.body.classList.add(window.dt ? 'disableTransparent' : 'transparent')
document.documentElement.style.fontSize = windowSizeActive.value.fontSize
}
}, {
immediate: true,
})
useApp()
onMounted(() => {

View File

@ -1,4 +1,4 @@
import { openUrl } from '@renderer/utils'
import { openUrl, getFontSizeWithScreen } from '@renderer/utils'
import { base as eventBaseName } from '@renderer/event/names'
import { onSetConfig, onSystemThemeChange } from '@renderer/utils/tools'
import { isFullscreen, themeShouldUseDarkColors } from '@renderer/core/share'
@ -44,10 +44,37 @@ export default ({
isProd,
isLinux,
}) => {
const setSetting = useCommit('setSetting')
const theme = useRefGetter('theme')
const font = useRefGetter('font')
const windowSizeActive = useRefGetter('windowSizeActive')
const setSetting = useCommit('setSetting')
const isShowAnimation = useRefGetter('isShowAnimation')
const dom_root = document.getElementById('root')
watch(theme, (val) => {
dom_root.className = val
})
watch(font, (val) => {
document.documentElement.style.fontFamily = val
}, {
immediate: true,
})
watch(isFullscreen, val => {
if (val) {
document.body.classList.remove(window.dt ? 'disableTransparent' : 'transparent')
document.body.classList.add('fullscreen')
document.documentElement.style.fontSize = getFontSizeWithScreen(window.screen.width) + 'px'
} else {
document.body.classList.remove('fullscreen')
document.body.classList.add(window.dt ? 'disableTransparent' : 'transparent')
document.documentElement.style.fontSize = windowSizeActive.value.fontSize
}
}, {
immediate: true,
})
watch(windowSizeActive, ({ fontSize }) => {
document.documentElement.style.fontSize = fontSize
})
@ -61,6 +88,8 @@ export default ({
document.body.classList.add('disableAnimation')
}
}
}, {
immediate: true,
})
const rSetConfig = onSetConfig((event, config) => {