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

This commit is contained in:
lyswhut
2022-05-05 16:02:09 +08:00
parent c758066e25
commit 8ab1bdf30a
3 changed files with 33 additions and 31 deletions
+1 -29
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(() => {