Add simple layout system
This commit is contained in:
parent
9fc70cfe57
commit
1b2f7a7941
3 changed files with 49 additions and 1 deletions
16
src/web/src/layouts/DefaultLayout.vue
Normal file
16
src/web/src/layouts/DefaultLayout.vue
Normal file
|
@ -0,0 +1,16 @@
|
|||
<!--
|
||||
Alpacca: The modern package repository hosting platform.
|
||||
Copyright (C) 2025, Zervó Zadachin
|
||||
|
||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
|
||||
The full copyright notice can be found at https://git.zervo.org/zervo/Alpacca/src/branch/main/COPYRIGHT.
|
||||
-->
|
||||
|
||||
<template>
|
||||
<v-app>
|
||||
<v-main>
|
||||
<slot />
|
||||
</v-main>
|
||||
</v-app>
|
||||
</template>
|
|
@ -1,8 +1,18 @@
|
|||
/*
|
||||
Alpacca: The modern package repository hosting platform.
|
||||
Copyright (C) 2025, Zervó Zadachin
|
||||
|
||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
|
||||
The full copyright notice can be found at https://git.zervo.org/zervo/Alpacca/src/branch/main/COPYRIGHT.
|
||||
*/
|
||||
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import Index from '@/views/Index.vue'
|
||||
import { withLayout } from './layoutWrapper'
|
||||
|
||||
const routes = [
|
||||
{ path: '/', component: Index },
|
||||
{ path: '/', component: withLayout(Index) },
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
|
|
22
src/web/src/router/layoutWrapper.ts
Normal file
22
src/web/src/router/layoutWrapper.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Alpacca: The modern package repository hosting platform.
|
||||
Copyright (C) 2025, Zervó Zadachin
|
||||
|
||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
|
||||
The full copyright notice can be found at https://git.zervo.org/zervo/Alpacca/src/branch/main/COPYRIGHT.
|
||||
*/
|
||||
|
||||
import { defineComponent, h } from 'vue'
|
||||
import DefaultLayout from '@/layouts/DefaultLayout.vue'
|
||||
|
||||
export function withLayout (pageComponent: any, layoutComponent: any = DefaultLayout) {
|
||||
return defineComponent({
|
||||
name: 'WrappedWithLayout',
|
||||
render () {
|
||||
return h(layoutComponent, {}, {
|
||||
default: () => h(pageComponent),
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
Loading…
Add table
Reference in a new issue