调整后台菜单选中问题
parent
755c706605
commit
f6c0566060
|
|
@ -22,27 +22,23 @@ class Menu extends DcatLayoutMenu
|
|||
if (empty($item['uri'])) {
|
||||
return false;
|
||||
}
|
||||
// return trim($this->getPath($item['uri']), '/') == $path;
|
||||
// dd($path, trim($this->getPath($item['uri']), '/admin'), strpos($path, trim($this->getPath($item['uri']), '/admin')));
|
||||
$_uri = trim($this->getPath($item['uri']), '/admin');
|
||||
if (empty($_uri) && $path!=='admin') {
|
||||
$_uri = trim(str_replace('/admin', '', $this->getPath($item['uri'])), '/');
|
||||
if (empty($_uri) && $path !== 'admin') {
|
||||
return false;
|
||||
}
|
||||
return strpos($path, $_uri) !== false;
|
||||
}
|
||||
|
||||
|
||||
foreach ($item['children'] as $v) {
|
||||
// $_uri = trim($this->getPath($item['uri']), '/admin');
|
||||
// if (empty($_uri) && $path!=='admin') {
|
||||
// return false;
|
||||
// }
|
||||
// if (strpos($path, $_uri) !== false) {
|
||||
// return true;
|
||||
// }
|
||||
dd($v, empty($v['children']));
|
||||
$_uri = trim(str_replace('/admin', '', $this->getPath($v['uri'])), '/');
|
||||
if (empty($_uri) && $path !== 'admin') {
|
||||
return false;
|
||||
}
|
||||
if (strpos($path, $_uri) !== false) {
|
||||
return true;
|
||||
}
|
||||
//针对大于2级的菜单
|
||||
if (! empty($v['children'])) {
|
||||
dd($v, $path);
|
||||
if ($this->isActive($v, $path)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class AppServiceProvider extends ServiceProvider
|
|||
$this->registerEasyWeChat();
|
||||
$this->registerRequestRealIp();
|
||||
$this->registerSettings();
|
||||
// $this->registerAdminMenu();
|
||||
$this->registerAdminMenu();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue