-
Notifications
You must be signed in to change notification settings - Fork 24
/
_Host.cshtml
70 lines (61 loc) · 1.95 KB
/
_Host.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
@page "_Host"
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@using HybridBlazor.Client
@using HybridBlazor.Server
@using Microsoft.Extensions.Options
@inject IOptions<HybridOptions> HybridOptions
@{
var hybridType = HybridOptions?.Value?.HybridType ?? HybridType.HybridOnNavigation;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>HybridBlazor: @hybridType</title>
<base href="/" />
<link href="css/app.css" rel="stylesheet" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="HybridBlazor.Client.styles.css" rel="stylesheet" />
</head>
<body>
@if (hybridType.ToString().StartsWith("Hybrid"))
{
<srvr-app>
<component type="typeof(App)" render-mode="ServerPrerendered" />
<persist-component-state />
</srvr-app>
<wasm-app style="display: none;">
<component type="typeof(App)" render-mode="WebAssembly">
</wasm-app>
}
<script>
window.hybridType = '@hybridType';
window.getHybridType = function () { return window.hybridType; }
</script>
@if (hybridType == HybridType.ServerSide)
{
<app>
<component type="typeof(App)" render-mode="ServerPrerendered" />
<persist-component-state />
</app>
<script src="_framework/blazor.server.js"></script>
}
else if (hybridType == HybridType.WebAssembly)
{
<app>
<component type="typeof(App)" render-mode="WebAssemblyPrerendered">
</app>
<script src="_framework/blazor.webassembly.js"></script>
}
else
{
<script src="blazor.hybrid.js"></script>
}
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
</body>
</html>