fix home layout bug

This commit is contained in:
donne1226 2022-03-14 20:59:02 +08:00
parent 3aa8c63fe4
commit 48b350fd87

View File

@ -7,12 +7,10 @@
<component :is="layout"> <component :is="layout">
<router-view /> <router-view />
</component> </component>
</div> </div>
</template> </template>
<script> <script>
// This will be populated in `beforeCreate` hook // This will be populated in `beforeCreate` hook
import { $themeColors, $themeBreakpoints, $themeConfig } from '@themeConfig' import { $themeColors, $themeBreakpoints, $themeConfig } from '@themeConfig'
import { provideToast } from 'vue-toastification/composition' import { provideToast } from 'vue-toastification/composition'
@ -29,19 +27,17 @@ const LayoutFull = () => import('@/layouts/full/LayoutFull.vue')
export default { export default {
components: { components: {
// Layouts // Layouts
LayoutHorizontal, LayoutHorizontal,
LayoutVertical, LayoutVertical,
LayoutFull, LayoutFull,
}, },
// ! We can move this computed: layout & contentLayoutType once we get to use Vue 3 // ! We can move this computed: layout & contentLayoutType once we get to use Vue 3
// Currently, router.currentRoute is not reactive and doesn't trigger any change // Currently, router.currentRoute is not reactive and doesn't trigger any change
computed: { computed: {
layout() { layout() {
if (this.$route.meta.layout === 'full') return 'layout-full' if (!this.$route.name || this.$route.meta.layout === 'full') return 'layout-full'
return `layout-${this.contentLayoutType}` return `layout-${this.contentLayoutType}`
}, },
contentLayoutType() { contentLayoutType() {
@ -62,7 +58,9 @@ export default {
// eslint-disable-next-line no-plusplus // eslint-disable-next-line no-plusplus
for (let i = 0, len = breakpoints.length; i < len; i++) { for (let i = 0, len = breakpoints.length; i < len; i++) {
$themeBreakpoints[breakpoints[i]] = Number(useCssVar(`--breakpoint-${breakpoints[i]}`, document.documentElement).value.slice(0, -2)) $themeBreakpoints[breakpoints[i]] = Number(
useCssVar(`--breakpoint-${breakpoints[i]}`, document.documentElement).value.slice(0, -2),
)
} }
// Set RTL // Set RTL