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