-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🆕 feat(PopupService): Add the advance usage to open custom popup comp…
…onent (#1048) * 🆕 feat(PopupService): Add the advance usage * 📝 docs: missing diff about error-handler * 📝 docs: Update nav.json
- Loading branch information
Showing
13 changed files
with
171 additions
and
44 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
docs/Masa.Blazor.Docs/Examples/components/popup-service/Advance.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@inject IPopupService PopupService | ||
|
||
<MButton OnClick="OnClick" Class="text-capitalize">Open the CustomPopupComponent</MButton> | ||
|
||
@code { | ||
|
||
private async Task OnClick() | ||
{ | ||
await OpenCustomPopupAsync("content here", AlertTypes.Info); | ||
} | ||
|
||
private async Task OpenCustomPopupAsync(string content, AlertTypes type) | ||
{ | ||
await PopupService.OpenAsync(typeof(CustomPopupComponent), new Dictionary<string, object?>() | ||
{ | ||
{ nameof(CustomPopupComponent.Content), content }, | ||
{ nameof(CustomPopupComponent.Type), type } | ||
}); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
docs/Masa.Blazor.Docs/Examples/components/popup-service/CustomPopupComponent.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@inherits Masa.Blazor.Popup.Components.PopupComponentBase | ||
|
||
<MDialog Value="Visible" MaxWidth="360"> | ||
<MAlert Class="mb-0" Type="@Type" Dismissible Value="Visible" ValueChanged="ValueChanged">@Content</MAlert> | ||
</MDialog> | ||
|
||
@code { | ||
|
||
[Parameter, EditorRequired] | ||
public string? Content { get; set; } | ||
|
||
[Parameter] | ||
public AlertTypes Type { get; set; } | ||
|
||
private async Task ValueChanged(bool val) | ||
{ | ||
Visible = val; | ||
|
||
await ClosePopupAsync(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters