Home  >  Article  >  Backend Development  >  在 Laravel 5.1 中使用 Pjax

在 Laravel 5.1 中使用 Pjax

WBOY
WBOYOriginal
2016-06-20 12:45:34919browse

在 Laravel 5.* 的版本中,使用 Pjax 实现无刷新效果,以及酷炫的进度条

项目地址:https://github.com/yccphp/pjax-for-laravel-5

效果

安装

1.在 composer.json 的 require里 加入

"yuanchao/pjax-for-laravel-5": "dev-master"

2.执行 composer update

3.在config/app.php 的 providers 数组加入一条

YuanChao\Pjax\EndaPjaxServiceProvider::class

4.在 Kernel 的 $middleware 数组里添加

\YuanChao\Pjax\EndaPjaxMiddleware::class,

5.执行 php artisan vendor:publish

使用

必须先引入 jquery

必须先引入 jquery

必须先引入 jquery

在布局文件中,插入以下代码

@include('pjax::pjax')
最后

求 star

求 star

求 star

欢迎加入laravel学习小组交流:365969825

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn