Skip to content

Commit 135423c

Browse files
committed
优化
1 parent 844b8c9 commit 135423c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/larke/admin/Extension/Event.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ public function __set(string $component, $value)
8080

8181
$component = $this->handle . ':' . $component;
8282

83-
if ($this->type == 'action') {
84-
AdminEvent::action()->listen($component, $value, $weight);
85-
} else {
83+
if ($this->type == 'filter') {
8684
AdminEvent::filter()->listen($component, $value, $weight);
85+
} else {
86+
AdminEvent::action()->listen($component, $value, $weight);
8787
}
8888
}
8989

@@ -92,23 +92,25 @@ public function __set(string $component, $value)
9292
*
9393
* @param string $component 当前组件
9494
* @param mixed $args 参数
95+
* @return mixed
9596
*/
9697
public function call(string $component, ...$args)
9798
{
9899
$component = $this->handle . ':' . $component;
99100

100-
if ($this->type == 'action') {
101-
AdminEvent::action()->trigger($component, ...$args);
102-
} else {
101+
if ($this->type == 'filter') {
103102
return AdminEvent::filter()->trigger($component, ...$args);
103+
} else {
104+
AdminEvent::action()->trigger($component, ...$args);
104105
}
105106
}
106107

107108
/**
108109
* 回调函数
109110
*
110111
* @param string $component 当前组件
111-
* @param array $args 参数
112+
* @param array $args 参数
113+
* @return mixed
112114
*/
113115
public function __call(string $component, array $args)
114116
{

0 commit comments

Comments
 (0)