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'])) { 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;
} }

View File

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