diff --git a/beike/Admin/View/Components/Alert.php b/beike/Admin/View/Components/Alert.php index 4564d292..6752e63f 100644 --- a/beike/Admin/View/Components/Alert.php +++ b/beike/Admin/View/Components/Alert.php @@ -9,9 +9,9 @@ class Alert extends Component public string $type; public string $msg; - public function __construct(string $type, string $msg) + public function __construct(?string $type = 'success', string $msg) { - $this->type = $type; + $this->type = $type ?? 'success'; $this->msg = $msg; } diff --git a/beike/Shop/View/Components/Alert.php b/beike/Shop/View/Components/Alert.php index be6c2454..e9f178ed 100644 --- a/beike/Shop/View/Components/Alert.php +++ b/beike/Shop/View/Components/Alert.php @@ -9,9 +9,9 @@ class Alert extends Component public string $type; public string $msg; - public function __construct(string $type, string $msg) + public function __construct(?string $type = 'success', string $msg) { - $this->type = $type; + $this->type = $type ?? 'success'; $this->msg = $msg; } diff --git a/resources/beike/admin/views/components/alert.blade.php b/resources/beike/admin/views/components/alert.blade.php index 9ab92d72..0fe2eae1 100644 --- a/resources/beike/admin/views/components/alert.blade.php +++ b/resources/beike/admin/views/components/alert.blade.php @@ -1,4 +1,4 @@ -