feat(frontend): enable Livewire SPA navigation (wire:navigate)
Build and Deploy / verify (push) Failing after 39m48s
Build and Deploy / deploy (push) Skipped

This commit is contained in:
2026-10-12 12:30:58 +00:00
parent b062e09db0
commit 6adfacc4e5
23 changed files with 58 additions and 58 deletions
+2 -2
View File
@@ -12,11 +12,11 @@
<ul class="archive-list">
@foreach($months as $month => $monthPosts)
<li>
<a href="{{ route('archives.month', $year.$month) }}">{{ (int) $month }} 月</a>
<a wire:navigate href="{{ route('archives.month', $year.$month) }}">{{ (int) $month }} 月</a>
<span class="count">({{ $monthPosts->count() }} 篇)</span>
<ul class="archive-posts">
@foreach($monthPosts as $post)
<li><a href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a> <time>{{ $post->published_at->format(blog_setting('listtime', 'm-d')) }}</time></li>
<li><a wire:navigate href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a> <time>{{ $post->published_at->format(blog_setting('listtime', 'm-d')) }}</time></li>
@endforeach
</ul>
</li>
+1 -1
View File
@@ -10,7 +10,7 @@
<div class="comment" id="comment-{{ $comment->id }}">
<div class="comment-head">
<strong>{{ $comment->author_name }}</strong>
<span>· 评论于 <a href="{{ route('posts.show', $comment->post->id) }}#comment-{{ $comment->id }}">{{ $comment->post->title }}</a></span>
<span>· 评论于 <a wire:navigate href="{{ route('posts.show', $comment->post->id) }}#comment-{{ $comment->id }}">{{ $comment->post->title }}</a></span>
<span class="comment-time">· {{ $comment->created_at->format(blog_setting('comment_timeformat', 'Y-m-d H:i')) }}</span>
</div>
<div class="comment-body">{!! nl2br(e($comment->content)) !!}</div>
+1 -1
View File
@@ -21,7 +21,7 @@
@error('email')<p class="error">{{ $message }}</p>@enderror
<button type="submit" class="btn btn-primary">登录</button>
</form>
<p class="auth-alt">还没有账号?<a href="{{ route('register') }}">立即注册</a></p>
<p class="auth-alt">还没有账号?<a wire:navigate href="{{ route('register') }}">立即注册</a></p>
</main>
</div>
@include('partials.footer')
+2 -2
View File
@@ -13,7 +13,7 @@
<div class="alert alert-error">你还不是会员,开通后可解锁会员专享文章。</div>
@endif
@else
<div class="alert alert-error">请先 <a href="{{ route('login') }}">登录</a> 后购买会员。</div>
<div class="alert alert-error">请先 <a wire:navigate href="{{ route('login') }}">登录</a> 后购买会员。</div>
@endauth
<div class="plans-grid" style="display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:16px;">
@@ -35,7 +35,7 @@
@endforelse
</div>
<p style="margin-top:16px;"><a href="{{ route('membership.mine') }}">查看我的订阅</a></p>
<p style="margin-top:16px;"><a wire:navigate href="{{ route('membership.mine') }}">查看我的订阅</a></p>
</main>
@include('partials.sidebar')
</div>
+1 -1
View File
@@ -21,7 +21,7 @@
</div>
</div>
@empty
<div class="empty">暂无订阅记录,<a href="{{ route('membership.index') }}">去开通会员</a></div>
<div class="empty">暂无订阅记录,<a wire:navigate href="{{ route('membership.index') }}">去开通会员</a></div>
@endforelse
</main>
@include('partials.sidebar')
@@ -11,9 +11,9 @@
<button type="submit" class="btn btn-primary">单篇解锁 ¥{{ number_format($price / 100, 2) }}</button>
</form>
@else
<a href="{{ route('membership.index') }}" class="btn btn-primary">开通会员</a>
<a wire:navigate href="{{ route('membership.index') }}" class="btn btn-primary">开通会员</a>
@endif
@else
<a href="{{ route('login') }}" class="btn btn-primary">登录后查看</a>
<a wire:navigate href="{{ route('login') }}" class="btn btn-primary">登录后查看</a>
@endauth
</div>
+2 -2
View File
@@ -41,11 +41,11 @@
</form>
@endif
@if($plansExist)
<a href="{{ route('membership.index') }}" class="btn">开通会员</a>
<a wire:navigate href="{{ route('membership.index') }}" class="btn">开通会员</a>
@endif
@endif
@else
<a href="{{ route('login') }}" class="btn btn-primary">登录后解锁</a>
<a wire:navigate href="{{ route('login') }}" class="btn btn-primary">登录后解锁</a>
@endauth
</div>
</div>
+9 -9
View File
@@ -1,31 +1,31 @@
<header class="site-header">
<div class="container">
<div class="site-brand">
<a href="{{ route('home') }}" class="site-title">{{ $siteName }}</a>
<a wire:navigate href="{{ route('home') }}" class="site-title">{{ $siteName }}</a>
@if($siteDescription)
<p class="site-desc">{{ $siteDescription }}</p>
@endif
</div>
<nav class="site-nav">
<a href="{{ route('home') }}" class="{{ request()->routeIs('home') ? 'active' : '' }}">首页</a>
<a href="{{ route('archives') }}" class="{{ request()->routeIs('archives*') ? 'active' : '' }}">归档</a>
<a href="{{ route('tags') }}" class="{{ request()->routeIs('tags*') ? 'active' : '' }}">标签</a>
<a href="{{ route('links') }}" class="{{ request()->routeIs('links') ? 'active' : '' }}">友链</a>
<a href="{{ route('comments') }}" class="{{ request()->routeIs('comments') ? 'active' : '' }}">评论</a>
<a wire:navigate href="{{ route('home') }}" class="{{ request()->routeIs('home') ? 'active' : '' }}">首页</a>
<a wire:navigate href="{{ route('archives') }}" class="{{ request()->routeIs('archives*') ? 'active' : '' }}">归档</a>
<a wire:navigate href="{{ route('tags') }}" class="{{ request()->routeIs('tags*') ? 'active' : '' }}">标签</a>
<a wire:navigate href="{{ route('links') }}" class="{{ request()->routeIs('links') ? 'active' : '' }}">友链</a>
<a wire:navigate href="{{ route('comments') }}" class="{{ request()->routeIs('comments') ? 'active' : '' }}">评论</a>
@include('partials.feed-links')
<form class="site-search" action="{{ route('search') }}" method="get">
<input type="search" name="q" placeholder="搜索..." value="{{ request('q', request('keyword', '')) }}">
</form>
@auth
<a href="{{ route('profile') }}">{{ auth()->user()->name }}</a>
<a wire:navigate href="{{ route('profile') }}">{{ auth()->user()->name }}</a>
@include('partials.admin-link')
<form action="{{ route('logout') }}" method="post" class="inline-form">
@csrf
<button type="submit" class="link-btn">退出</button>
</form>
@else
<a href="{{ route('login') }}">登录</a>
<a href="{{ route('register') }}">注册</a>
<a wire:navigate href="{{ route('login') }}">登录</a>
<a wire:navigate href="{{ route('register') }}">注册</a>
@endauth
</nav>
</div>
@@ -5,7 +5,7 @@
@if ($paginator->onFirstPage())
<span class="disabled">&laquo;</span>
@else
<a href="{{ $paginator->previousPageUrl() }}" rel="prev">&laquo;</a>
<a wire:navigate href="{{ $paginator->previousPageUrl() }}" rel="prev">&laquo;</a>
@endif
@foreach ($elements as $element)
@@ -17,14 +17,14 @@
@if ($page == $paginator->currentPage())
<span class="current">{{ $page }}</span>
@else
<a href="{{ $url }}">{{ $page }}</a>
<a wire:navigate href="{{ $url }}">{{ $page }}</a>
@endif
@endforeach
@endif
@endforeach
@if ($paginator->hasMorePages())
<a href="{{ $paginator->nextPageUrl() }}" rel="next">&raquo;</a>
<a wire:navigate href="{{ $paginator->nextPageUrl() }}" rel="next">&raquo;</a>
@else
<span class="disabled">&raquo;</span>
@endif
+5 -5
View File
@@ -6,19 +6,19 @@
@endphp
<article class="post-card {{ $post->isPinned() ? 'sticky' : '' }} post-card-{{ $viewMode }}">
@if($url = $post->coverImageUrl())
<a href="{{ route('posts.show', $post->id) }}" class="post-cover">
<a wire:navigate href="{{ route('posts.show', $post->id) }}" class="post-cover">
<img src="{{ $url }}" alt="{{ $post->title }}" loading="lazy">
</a>
@endif
<h2 class="post-title">
@if($label = $post->stickyLabel())<span class="badge">{{ $label }}</span>@endif
<a href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a>
<a wire:navigate href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a>
</h2>
<div class="post-meta">
<time datetime="{{ $post->published_at->toIso8601String() }}">{{ $post->published_at->format(blog_setting('normaltime', 'Y-m-d H:i')) }}</time>
@if($post->category)
<span>·</span>
<a href="{{ route('category.show', $post->category->id) }}">{{ $post->category->name }}</a>
<a wire:navigate href="{{ route('category.show', $post->category->id) }}">{{ $post->category->name }}</a>
@endif
<span>· 阅读 {{ $post->views }}</span>
<span>· 评论 {{ $post->comment_count }}</span>
@@ -33,9 +33,9 @@
</div>
@endif
<div class="post-footer">
<a href="{{ route('posts.show', $post->id) }}" class="read-more">阅读全文 &raquo;</a>
<a wire:navigate href="{{ route('posts.show', $post->id) }}" class="read-more">阅读全文 &raquo;</a>
@foreach($post->tags as $tag)
<a href="{{ route('tags.show', $tag->name) }}" class="tag-link">#{{ $tag->name }}</a>
<a wire:navigate href="{{ route('tags.show', $tag->name) }}" class="tag-link">#{{ $tag->name }}</a>
@endforeach
</div>
</article>
+4 -4
View File
@@ -5,7 +5,7 @@
<ul class="widget-list">
@forelse($categories as $category)
<li>
<a href="{{ route('category.show', $category->id) }}">{{ $category->name }}</a>
<a wire:navigate href="{{ route('category.show', $category->id) }}">{{ $category->name }}</a>
<span class="count">({{ $category->post_count }})</span>
</li>
@empty
@@ -18,7 +18,7 @@
<h3 class="widget-title">最新文章</h3>
<ul class="widget-list">
@forelse($recentPosts as $post)
<li><a href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a></li>
<li><a wire:navigate href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a></li>
@empty
<li>暂无文章</li>
@endforelse
@@ -30,7 +30,7 @@
<ul class="widget-list">
@forelse($recentComments as $comment)
<li>
<a href="{{ route('posts.show', $comment->post->id) }}#comment-{{ $comment->id }}">
<a wire:navigate href="{{ route('posts.show', $comment->post->id) }}#comment-{{ $comment->id }}">
{{ $comment->author_name }}:{{ Str::limit(strip_tags($comment->content), 30) }}
</a>
</li>
@@ -44,7 +44,7 @@
<h3 class="widget-title">标签云</h3>
<div class="tag-cloud">
@forelse($hotTags as $tag)
<a href="{{ route('tags.show', $tag->name) }}" class="tag-link">{{ $tag->name }}</a>
<a wire:navigate href="{{ route('tags.show', $tag->name) }}" class="tag-link">{{ $tag->name }}</a>
@empty
<span>暂无标签</span>
@endforelse
+1 -1
View File
@@ -14,7 +14,7 @@
@endif
<p><strong>商品:</strong>{{ $payment->subject }}</p>
<p><strong>金额:</strong>¥{{ number_format($payment->amount / 100, 2) }}</p>
<p class="auth-alt"><a href="{{ route('home') }}">返回首页</a></p>
<p class="auth-alt"><a wire:navigate href="{{ route('home') }}">返回首页</a></p>
</main>
</div>
@include('partials.footer')
+1 -1
View File
@@ -16,7 +16,7 @@
@csrf
<button type="submit" class="btn btn-primary">确认支付(模拟)</button>
</form>
<p class="auth-alt"><a href="{{ route('home') }}">取消,返回首页</a></p>
<p class="auth-alt"><a wire:navigate href="{{ route('home') }}">取消,返回首页</a></p>
</main>
</div>
@include('partials.footer')
+1 -1
View File
@@ -18,7 +18,7 @@
<p><a href="{{ url('/admin') }}" target="_blank" rel="noopener">进入后台管理</a></p>
@endif
</div>
<p><a href="{{ route('home') }}">&laquo; 返回首页</a></p>
<p><a wire:navigate href="{{ route('home') }}">&laquo; 返回首页</a></p>
</main>
@include('partials.sidebar')
</div>
+1 -1
View File
@@ -32,7 +32,7 @@
</div>
<button type="submit" class="btn btn-primary">注册</button>
</form>
<p class="auth-alt">已有账号?<a href="{{ route('login') }}">去登录</a></p>
<p class="auth-alt">已有账号?<a wire:navigate href="{{ route('login') }}">去登录</a></p>
</main>
</div>
@include('partials.footer')
+2 -2
View File
@@ -45,7 +45,7 @@
@endif
@if($post->author)<span>· {{ $post->author->name }}</span>@endif
@if($post->category)
<span>· <a href="{{ route('category.show', $post->category->id) }}">{{ $post->category->name }}</a></span>
<span>· <a wire:navigate href="{{ route('category.show', $post->category->id) }}">{{ $post->category->name }}</a></span>
@endif
<span>· 阅读 {{ $post->views }}</span>
</div>
@@ -59,7 +59,7 @@
@if($post->tags->isNotEmpty())
<div class="post-tags">
@foreach($post->tags as $tag)
<a href="{{ route('tags.show', $tag->name) }}" class="tag-link">#{{ $tag->name }}</a>
<a wire:navigate href="{{ route('tags.show', $tag->name) }}" class="tag-link">#{{ $tag->name }}</a>
@endforeach
</div>
@endif
+1 -1
View File
@@ -7,7 +7,7 @@
<h1 class="list-title">全部标签</h1>
<div class="tag-cloud big">
@forelse($tags as $tag)
<a href="{{ route('tags.show', $tag->name) }}" class="tag-link" style="font-size: {{ max(0.9, min(1.8, 0.9 + $tag->posts_count * 0.1)) }}em">
<a wire:navigate href="{{ route('tags.show', $tag->name) }}" class="tag-link" style="font-size: {{ max(0.9, min(1.8, 0.9 + $tag->posts_count * 0.1)) }}em">
{{ $tag->name }} ({{ $tag->posts_count }})
</a>
@empty
+2 -4
View File
@@ -31,16 +31,14 @@
Dashboard
</a>
@else
<a
href="{{ route('login') }}"
<a wire:navigate href="{{ route('login') }}"
class="inline-block px-5 py-1.5 dark:text-[#EDEDEC] text-[#1b1b18] border border-transparent hover:border-[#19140035] dark:hover:border-[#3E3E3A] rounded-sm text-sm leading-normal"
>
Log in
</a>
@if (Route::has('register'))
<a
href="{{ route('register') }}"
<a wire:navigate href="{{ route('register') }}"
class="inline-block px-5 py-1.5 dark:text-[#EDEDEC] border-[#19140035] hover:border-[#1915014a] border text-[#1b1b18] dark:border-[#3E3E3A] dark:hover:border-[#62605b] rounded-sm text-sm leading-normal">
Register
</a>
@@ -7,3 +7,4 @@
<p>Powered by LaraLog · Laravel · Filament</p>
</footer>
</div>{{-- #outmain --}}
@livewireScripts
@@ -14,6 +14,7 @@
<link rel="alternate" type="application/rss+xml" title="{{ $siteName }}" href="{{ route('feed.rss') }}">
<link rel="alternate" type="text/plain" title="llms.txt" href="{{ route('feed.llms') }}">
<link rel="stylesheet" href="{{ theme('asset', 'style.css') }}">
@livewireStyles
@stack('head')
@stack('theme:head')
</head>
@@ -1,20 +1,20 @@
<div id="outmain">
<header id="header">
<div class="logo">
<a href="{{ route('home') }}">{{ $siteName }}</a>
<a wire:navigate href="{{ route('home') }}">{{ $siteName }}</a>
<p class="description">{{ $siteDescription }}</p>
</div>
@include('partials.theme-inject', ['point' => 'header'])
<nav id="nav">
<ul>
<li class="{{ request()->routeIs('home') ? 'current_page_item' : '' }}"><a href="{{ route('home') }}">首页</a></li>
<li class="{{ request()->routeIs('archives*') ? 'current_page_item' : '' }}"><a href="{{ route('archives') }}">归档</a></li>
<li class="{{ request()->routeIs('tags*') ? 'current_page_item' : '' }}"><a href="{{ route('tags') }}">标签</a></li>
<li class="{{ request()->routeIs('links') ? 'current_page_item' : '' }}"><a href="{{ route('links') }}">友链</a></li>
<li class="{{ request()->routeIs('comments') ? 'current_page_item' : '' }}"><a href="{{ route('comments') }}">评论</a></li>
<li class="{{ request()->routeIs('home') ? 'current_page_item' : '' }}"><a wire:navigate href="{{ route('home') }}">首页</a></li>
<li class="{{ request()->routeIs('archives*') ? 'current_page_item' : '' }}"><a wire:navigate href="{{ route('archives') }}">归档</a></li>
<li class="{{ request()->routeIs('tags*') ? 'current_page_item' : '' }}"><a wire:navigate href="{{ route('tags') }}">标签</a></li>
<li class="{{ request()->routeIs('links') ? 'current_page_item' : '' }}"><a wire:navigate href="{{ route('links') }}">友链</a></li>
<li class="{{ request()->routeIs('comments') ? 'current_page_item' : '' }}"><a wire:navigate href="{{ route('comments') }}">评论</a></li>
@include('partials.feed-links', ['asList' => true])
@auth
<li><a href="{{ route('profile') }}">{{ auth()->user()->name }}</a></li>
<li><a wire:navigate href="{{ route('profile') }}">{{ auth()->user()->name }}</a></li>
@include('partials.admin-link', ['asList' => true])
<li>
<form action="{{ route('logout') }}" method="post" class="inline-form">
@@ -23,8 +23,8 @@
</form>
</li>
@else
<li><a href="{{ route('login') }}">登录</a></li>
<li><a href="{{ route('register') }}">注册</a></li>
<li><a wire:navigate href="{{ route('login') }}">登录</a></li>
<li><a wire:navigate href="{{ route('register') }}">注册</a></li>
@endauth
</ul>
</nav>
@@ -11,7 +11,7 @@
<h3>分类</h3>
<ul>
@forelse($categories as $category)
<li><a href="{{ route('category.show', $category->id) }}">{{ $category->name }}</a> ({{ $category->post_count }})</li>
<li><a wire:navigate href="{{ route('category.show', $category->id) }}">{{ $category->name }}</a> ({{ $category->post_count }})</li>
@empty
<li>暂无分类</li>
@endforelse
@@ -22,7 +22,7 @@
<h3>最新文章</h3>
<ul>
@forelse($recentPosts as $post)
<li><a href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a></li>
<li><a wire:navigate href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a></li>
@empty
<li>暂无文章</li>
@endforelse
@@ -33,7 +33,7 @@
<h3>最新评论</h3>
<ul>
@forelse($recentComments as $comment)
<li><a href="{{ route('posts.show', $comment->post->id) }}#comment-{{ $comment->id }}">{{ $comment->author_name }}:{{ Str::limit(strip_tags($comment->content), 20) }}</a></li>
<li><a wire:navigate href="{{ route('posts.show', $comment->post->id) }}#comment-{{ $comment->id }}">{{ $comment->author_name }}:{{ Str::limit(strip_tags($comment->content), 20) }}</a></li>
@empty
<li>暂无评论</li>
@endforelse
@@ -44,7 +44,7 @@
<h3>标签</h3>
<p class="tagcloud">
@forelse($hotTags as $tag)
<a href="{{ route('tags.show', $tag->name) }}">{{ $tag->name }}</a>
<a wire:navigate href="{{ route('tags.show', $tag->name) }}">{{ $tag->name }}</a>
@empty
暂无标签
@endforelse
+2 -2
View File
@@ -43,7 +43,7 @@
@endif
@if($post->author)<span>· {{ $post->author->name }}</span>@endif
@if($post->category)
<span>· <a href="{{ route('category.show', $post->category->id) }}">{{ $post->category->name }}</a></span>
<span>· <a wire:navigate href="{{ route('category.show', $post->category->id) }}">{{ $post->category->name }}</a></span>
@endif
<span>· 阅读 {{ $post->views }}</span>
</div>
@@ -57,7 +57,7 @@
@if($post->tags->isNotEmpty())
<div class="post-tags">
@foreach($post->tags as $tag)
<a href="{{ route('tags.show', $tag->name) }}" class="tag-link">#{{ $tag->name }}</a>
<a wire:navigate href="{{ route('tags.show', $tag->name) }}" class="tag-link">#{{ $tag->name }}</a>
@endforeach
</div>
@endif