xn / iframe-tabs
laravel-admin 扩展 iframe-tabs
dev-master
2022-03-18 07:42 UTC
Requires
- php: >=7.0.0
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2024-09-18 13:10:44 UTC
README
安装
运行
$ composer require xn/iframe-tabs
然后运行
$ php artisan vendor:publish --tag=iframe-tabs
$ php artisan admin:import iframe-tabs
更新它
php artisan vendor:publish --tag=iframe-tabs --force
这将覆盖 /public/vendor/laravel-admin-ext/iframe-tabs/
下的 css 和 js 文件
配置
在 config/admin.php
中添加配置
'extensions' => [
'iframe-tabs' => [
// Set to `false` if you want to disable this extension
'enable' => true,
// The controller and action of dashboard page `/admin/dashboard`
'home_action' => App\Admin\Controllers\HomeController::class . '@index',
// Default page tab-title
'home_title' => 'Home',
// Default page tab-title icon
'home_icon' => 'fa-home',
// Whether show icon befor titles for all tab
'use_icon' => true,
// dashboard css
'tabs_css' =>'vendor/laravel-admin-ext/iframe-tabs/dashboard.css',
// layer.js path
'layer_path' => 'vendor/laravel-admin-ext/iframe-tabs/layer/layer.js',
/**
* href links do not open in tab .
* selecter : .sidebar-menu li a,.navbar-nav>li a,.sidebar .user-panel a,.sidebar-form .dropdown-menu li a
* if(href.indexOf(pass_urls[i]) > -1) //pass
*/
'pass_urls' => ['/auth/logout', '/auth/lock'],
// When login session state of a tab-page was expired , force top-level window goto login page .
//登录超时是是否强制整体跳转到登录页面,设为false的话只在触发超时登录的页面跳转,最大程度保留已打开页面。
'force_login_in_top' => true,
// tabs left offset
'tabs_left' => 42,
// bind click event of table actions [edit / view / create]
'bind_urls' => 'popup', //[ popup / new_tab / none]
//table actions dom selecter, [view / edit / create]buttons ,and any thing has class pupop : <a class="pupop" popw="400px" poph="200px" href="someurl">mylink</a>
'bind_selecter' => 'a.grid-row-view,a.grid-row-edit,.column-__actions__ ul.dropdown-menu a,.box-header .pull-right .btn-success,.popup',
//layer popup size
'layer_size' => '1100px,98%',
// if run web in `cli` mode ,for example `swoole` ,set it to true,如果是以命令行方式运行网站,如`swoole` 就设置为 true
'web_in_cli' => false
]
],
如果 bind_urls
设置为 popup
或 new_tab
,建议在表单中设置 disableView
和 disableList
`/Admin/bootstrap.php` :
Xn\Admin\Form::init(function ($form) {
$form->tools(function ($tools) {
$tools->disableDelete();
$tools->disableView();
$tools->disableList();
});
});
见 https://laravel-admin.org/docs/zh/model-form-init
并且在展示时设置 disableEdit
和 disableList
$show->panel()
->tools(function ($tools) {
$tools->disableEdit();
$tools->disableList();
$tools->disableDelete();
});;
语言
在 resources/lang/{zh-CN}/admin.php
中添加语言配置
'iframe_tabs' => [
'oprations' => '页签操作',
'refresh_current' => '刷新当前',
'close_current' => '关闭当前',
'close_all' => '关闭全部',
'close_other' => '关闭其他',
'open_in_new' => '新窗口打开',
'open_in_pop' => '弹出窗打开',
'scroll_left' => '滚动到最左',
'scroll_right' => '滚动到最右',
'scroll_current' => '滚动到当前',
'goto_login' => '登录超时,正在跳转登录页面...'
],
用法
打开 http://your-host/admin
感谢 https://github.com/bswsfhcw/AdminLTE-With-Iframe
许可证
在 MIT 许可证 (MIT) 下许可。
此扩展基本稳定,除非 laravel-admin
的 UI 有较大变化。鉴于本人实际中使用 laravel-admin
不是太多,后续不提供新的功能特性,只修复 bug。
广告
使用 tp 框架的小伙伴可以尝试一下我新的后台开发框架:https://gitee.com/ichynul/myadmin
参照 laravel-admih 封装了 form
、table
等