From e5be0ca2f8cfb5aa070a5337c0a268a83df0a6de Mon Sep 17 00:00:00 2001 From: JaguarJack <82664165@qq.com> Date: Thu, 7 Mar 2024 11:28:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/Repository/Options/Components.php | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/modules/Common/Repository/Options/Components.php b/modules/Common/Repository/Options/Components.php index 03854cd..dd83f6e 100644 --- a/modules/Common/Repository/Options/Components.php +++ b/modules/Common/Repository/Options/Components.php @@ -20,23 +20,27 @@ class Components implements OptionInterface public function get(): array { - if ($module = request()->get('module')) { - $components = File::glob(CatchAdmin::getModuleViewsPath($module).'*'.DIRECTORY_SEPARATOR.'*.vue'); + try { + if ($module = request()->get('module')) { + $components = File::glob(CatchAdmin::getModuleViewsPath($module) . '*' . DIRECTORY_SEPARATOR . '*.vue'); - foreach ($components as $component) { - $_component = Str::of($component) - ->replace(CatchAdmin::moduleRootPath(), '') - ->explode(DIRECTORY_SEPARATOR); - $_component->shift(2); + foreach ($components as $component) { + $_component = Str::of($component) + ->replace(CatchAdmin::moduleRootPath(), '') + ->explode(DIRECTORY_SEPARATOR); + $_component->shift(2); - $this->components[] = [ - 'label' => Str::of($_component->implode('/'))->replace('.vue', ''), + $this->components[] = [ + 'label' => Str::of($_component->implode('/'))->replace('.vue', ''), - 'value' => Str::of($component)->replace(CatchAdmin::moduleRootPath(), '')->prepend('/') - ]; + 'value' => Str::of($component)->replace(CatchAdmin::moduleRootPath(), '')->prepend('/') + ]; + } } - } - return $this->components; + return $this->components; + } catch (\Throwable $exception) { + return []; + } } }