Skip to main content

新页面

root@linux:/var/www/example# cat ./resources/js/pages/mypage.tsx
import { Head } from '@inertiajs/react';

export default function Show({ user }: { user?: any }) {
  return (
    <>
    <Head title="Welcome" />
    <h1>Welcome</h1>
    {user ? (
    <p>Hello {user.name}, welcome to Inertia.</p>
    ) : (
    <p>Hel22lo 访客,请登录查看更多功能</p>
    )}
    </>
  );
}

root@linux:/var/www/example# cat ./routes/web.php
<?php

use Illuminate\Support\Facades\Route;
use Inertia\Inertia;

Route::inertia('/', 'welcome')->name('home');

Route::inertia('/mypage','mypage');

Route::middleware(['auth', 'verified'])->group(function () {
    Route::inertia('dashboard', 'dashboard')->name('dashboard');
});

require __DIR__.'/settings.php';