rajentrivedi / laravel-spa
dev-main
2022-04-12 02:45 UTC
This package is auto-updated.
Last update: 2024-01-01 11:33:48 UTC
README
将普通Laravel应用转换为SPA
安装
composer require rajentrivedi/laravel-spa
您需要在主blade文件的head部分使用以下blade指令,其中您加载所有资源。
@spa
示例
<!DOCTYPE html>
<html lang="en">
<head>
@spa
</head>
</html>
Blade指令用于编写javascript代码。
@spascript
$('#your_id').click(function(){
console.log('working');
})
@endspascript
如果您想禁用特定链接的SPA。
@disablespa
示例
<a href="{{route('excel.download')}}" class="btn btn-primary btn-md m-5" @disablespa>Excel</a>
此包将通过使用Tubolinks来提高页面加载速度。
就这些,您不需要做其他任何事情。