halivert/laravel-js-routes
最新稳定版本:v6.0.0
Composer 安装命令:
composer require halivert/laravel-js-routes
包简介
Command for use Laravel routes in JS
README 文档
README
Note
This package is not maintained anymore, I suggest you to use Ziggy since is a bigger one, with more support.
Anyways, thank you so much for your support 😄
Command for use Laravel routes in JS
Usage:
composer require halivert/laravel-js-routes
Execute artisan command
php artisan route:tojs
Add the resource to webpack.mix.js:
mix.js("resources/js/routes", "public/js");
Or add route function to bootstrap.js as stated in #1 by @clandestine8
window.route = require('./routes.js').route; // You can't use absolute routes with this method.
If you want to use absolute urls, you need to have MIX_APP_URL .env var
And to use it, you need to import it
import { route } from "./routes.js";
And voila! you can have the route function, the first parameter is the route
name (same as in laravel), the second is an array of parameters or an object,
and the third is if you want to use absolute paths, by default true.
License
Contributing
Pull requests and issues are welcome.
统计信息
- 总下载量: 10.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-11-04