added ssr?????

This commit is contained in:
Sockenklaus
2023-07-08 15:52:46 +02:00
parent 864da02de5
commit 5371f784fb
12 changed files with 1974 additions and 18 deletions

View File

@@ -7,21 +7,22 @@
/>
</template>
<script setup>
<script setup lang="ts">
import type { MenuOption } from 'naive-ui'
import { Link, usePage } from '@inertiajs/vue3'
import { h, ref, watch } from 'vue';
import { NIcon, NButton } from 'naive-ui'
import { h, ref } from 'vue';
import { NIcon } from 'naive-ui'
import {
GroupsFilled as Users,
EventNoteFilled as Events,
LogOutFilled as Logout
} from '@vicons/material'
const { request, isAdmin } = usePage().props
const activeKey = ref(request.url)
const isAdmin: boolean = (usePage().props.isAdmin as boolean)
const activeKey = ref<string>((usePage().props.request as any)?.url)
const menuOptions = ref([])
menuOptions.value.push({
const menuOptions: MenuOption[] = []
menuOptions.push({
label: () =>
h(
Link, {
@@ -34,7 +35,7 @@
icon: renderIcon(Events)
})
if(isAdmin) menuOptions.value.push({
if(isAdmin) menuOptions.push({
label: () =>
h(
Link, {
@@ -47,7 +48,7 @@
icon: renderIcon(Users)
})
menuOptions.value.push({
menuOptions.push({
label: () =>
h(
Link, {
@@ -63,7 +64,7 @@
function renderIcon(icon) {
function renderIcon(icon: any) {
return () => h(NIcon, null, { default: () => h(icon) })
}

16
resources/js/ssr.js Normal file
View File

@@ -0,0 +1,16 @@
import { createSSRApp, h } from 'vue';
import { renderToString } from '@vue/server-renderer';
import { createInertiaApp } from '@inertiajs/vue3';
export default function render(page) {
return createInertiaApp({
page,
render: renderToString,
resolve: (name) => require(`./pages/${name}`),
setup({ app, props, plugin }) {
return createSSRApp({
render: () => h(app, props),
}).use(plugin);
},
});
}

View File

@@ -9,7 +9,7 @@
@entryPointScripts('app')
<title>enzos-events</title>
@inertiaHead
</head>
<body>
@inertia