Max*_*lov 31
在Blazor0.5.0版本中添加了用于呈现原始HTML的功能.这是如何通过string包含HTML内容呈现原始HTML的示例:
@((MarkupString)myMarkup)
@functions {
string myMarkup = "<p class='markup'>This is a <em>markup string</em>.</p>";
}
Run Code Online (Sandbox Code Playgroud)
更多信息可以在"Blazor 0.5.0 Experimental release now available"公告中找到.
小智 13
是的,样本:
@page "/"
<h2>Title</h2>
<hr />
<p>
@ms
</p>
Run Code Online (Sandbox Code Playgroud)
@code {
MarkupString ms => (MarkupString)description;
string description = $@"
This is an example of how Azure serverless functions can be consumed from Blazor WASM.
<br><br>
To run this project in development mode, the <b>HttpTriggerSample</b> project must be run simultaneously.
<br><br>
Serverless Functions origin: <b>{fs}<b>.";
// by example
static string fs => Program.IS_DEVELOPMENT ? "DevelopmentStorage" : "Azure";
}
Run Code Online (Sandbox Code Playgroud)
您还可以将原始 HTML 作为字符串存储到类型的变量中MarkupString,然后无需转换即可使用它。
@myMarkup
@code {
private MarkupString myMarkup =
new MarkupString("<p class='markup'>This is a <em>markup string</em>.</p>");
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2881 次 |
| 最近记录: |