mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2025-12-06 05:32:03 +01:00
40 lines
852 B
Plaintext
40 lines
852 B
Plaintext
@page "/"
|
|
|
|
<PageTitle>Index</PageTitle>
|
|
|
|
<h1>Hello, world!</h1>
|
|
|
|
Welcome to your new app.
|
|
|
|
<SurveyPrompt Title="How is Blazor working for you?" />
|
|
|
|
<button type="button" class="btn btn-info" @onclick="AlertBrowser">
|
|
Poke the browser</button>
|
|
<hr />
|
|
<input id="colorBox" />
|
|
<button type="button" class="btn btn-info" @onclick="SetColor">
|
|
Set Color</button>
|
|
<button type="button" class="btn btn-info" @onclick="GetColor">
|
|
Get Color</button>
|
|
|
|
@code {
|
|
[Inject]
|
|
public IJSRuntime JSRuntime { get; set; } = null!;
|
|
|
|
public async Task AlertBrowser()
|
|
{
|
|
await JSRuntime.InvokeVoidAsync(
|
|
"messageBox", "Blazor poking the browser");
|
|
}
|
|
|
|
public async Task SetColor()
|
|
{
|
|
await JSRuntime.InvokeVoidAsync("setColorInStorage");
|
|
}
|
|
|
|
public async Task GetColor()
|
|
{
|
|
await JSRuntime.InvokeVoidAsync("getColorFromStorage");
|
|
}
|
|
}
|