V1.3.0
This commit is contained in:
31
notfound.py
31
notfound.py
@@ -9,32 +9,11 @@ Description: Findreve 404
|
||||
Copyright (c) 2018-2024 by 于小丘Yuerchu, All Rights Reserved.
|
||||
'''
|
||||
|
||||
from nicegui import ui
|
||||
from nicegui import app
|
||||
from fastapi import Request
|
||||
from fastapi.responses import HTMLResponse
|
||||
|
||||
def create() -> None:
|
||||
@ui.page('/404')
|
||||
async def not_found_page(request: Request, ref="") -> None:
|
||||
with ui.header() \
|
||||
.classes('items-center duration-300 py-2 px-5 no-wrap') \
|
||||
.style('box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1)'):
|
||||
|
||||
ui.button(icon='menu').props('flat color=white round')
|
||||
ui.button(text="HeyPress").classes('text-lg').props('flat color=white no-caps')
|
||||
|
||||
with ui.card().classes('absolute-center w-3/4 h-2/3'):
|
||||
|
||||
# 添加标题
|
||||
ui.button(icon='error', color='red').props('outline round').classes('mx-auto w-auto shadow-sm w-fill')
|
||||
ui.label('404').classes('text-h3 w-full text-center')
|
||||
|
||||
ui.space()
|
||||
|
||||
ui.label('页面不存在').classes('text-2xl w-full text-center')
|
||||
ui.label('Page Not Found').classes('text-2xl w-full text-center')
|
||||
|
||||
ui.space()
|
||||
|
||||
ui.button('返回首页',
|
||||
on_click=lambda: ui.navigate.to('/')) \
|
||||
.classes('items-center w-full').props('rounded')
|
||||
@app.get('/404')
|
||||
async def not_found_page(request: Request) -> None:
|
||||
return HTMLResponse(status_code=404)
|
||||
|
||||
Reference in New Issue
Block a user