Fix app rendering

This commit is contained in:
Kasper Seweryn 2022-04-18 02:40:34 +02:00 committed by Georg Krause
parent 3bde72a71b
commit 1cd2eea88a
No known key found for this signature in database
GPG Key ID: 2970D504B2183D22
5 changed files with 17 additions and 11 deletions

View File

@ -59,7 +59,7 @@
</style>
</head>
<body class="theme-light" id="body">
<body id="body">
<div id="fake-app">
<div id="fake-sidebar">
<div id="orange-square"></div>

View File

@ -480,6 +480,7 @@ import Modal from '@/components/semantic/Modal.vue'
import $ from 'jquery'
import useThemeList from '@/composables/useThemeList'
import useTheme from '@/composables/useTheme'
export default {
name: 'Sidebar',

View File

@ -1,12 +1,12 @@
import { useColorMode } from '@vueuse/core'
import { watch } from '@vue/composition-api'
const theme = useColorMode()
document.body.classList.add(`theme-${theme.value}`)
watch(theme, (newValue, oldValue) => {
document.body.classList.remove(`theme-${oldValue}`)
document.body.classList.add(`theme-${newValue}`)
const theme = useColorMode({
selector: 'body',
modes: {
auto: '',
light: 'theme-light',
dark: 'theme-dark'
}
})
export default () => theme

View File

@ -4,7 +4,9 @@ import VueLazyload from 'vue-lazyload'
import store from '~/store'
import { sync } from 'vuex-router-sync'
import VueCompositionAPI, { createApp } from '@vue/composition-api'
import { CreateElement } from 'vue'
import Vue, { CreateElement } from 'vue'
Vue.config.devtools = true
logger.default.info('Loading environment:', import.meta.env.MODE)
logger.default.debug('Environment variables:', import.meta.env)
@ -14,13 +16,16 @@ sync(store, router)
const app = createApp({
store,
router,
components: {
App: () => import('~/App.vue')
},
data: () => ({ isMounted: false }),
async mounted () {
this.isMounted = true
},
render (h: CreateElement) {
if (this.isMounted) {
return import('~/App.vue')
return h('app')
}
// TODO (wvffle): Import fake app component

View File

@ -58,7 +58,7 @@ export const install: AppModule = ({ store, app }) => {
document.documentElement.setAttribute('lang', htmlLocale)
if (locale === 'en_US') {
Vue.prototype.$language.current = locale
Vue.config.language = locale
store.commit('ui/momentLocale', 'en')
}
}, { immediate: true })