6
0
Fork 0

调整后台菜单选中问题

release
vine_liutk 2022-02-10 10:54:23 +08:00
parent 755c706605
commit f6c0566060
2 changed files with 11 additions and 15 deletions

View File

@ -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;
}

View File

@ -27,7 +27,7 @@ class AppServiceProvider extends ServiceProvider
$this->registerEasyWeChat();
$this->registerRequestRealIp();
$this->registerSettings();
// $this->registerAdminMenu();
$this->registerAdminMenu();
}
/**