39 lines
830 B
Plaintext
39 lines
830 B
Plaintext
@addTagHelper *, TestContentPackage
|
|
@using TestContentPackage
|
|
|
|
<h1>Functionality and content from an external package</h1>
|
|
|
|
<p>
|
|
NuGet packages can embed .NET code, which can in turn call Blazor's
|
|
JS interop features if desired. This can be used to distribute new
|
|
browser APIs as NuGet packages.
|
|
</p>
|
|
|
|
<p>Click the following button to invoke a JavaScript function.</p>
|
|
|
|
<button @onclick(ShowJavaScriptPrompt)>Show JavaScript prompt</button>
|
|
|
|
@if (!string.IsNullOrEmpty(result))
|
|
{
|
|
<p>Result: <strong>@result</strong></p>
|
|
}
|
|
|
|
<hr />
|
|
|
|
<p>
|
|
Additionally, NuGet packages can contain Blazor components, and even
|
|
static resources such as CSS files and images.
|
|
</p>
|
|
|
|
<ComponentFromPackage />
|
|
|
|
@functions
|
|
{
|
|
string result;
|
|
|
|
void ShowJavaScriptPrompt()
|
|
{
|
|
result = MyPrompt.Show("Hello!");
|
|
}
|
|
}
|