我想将原始 html 传递给 @helper 宏...这可能吗?例如:
@helper oneColumn(string content) {
<div class="row">
<div class="twelve columns">
@content
</div>
</div>
}
@put.oneColumn(
<h1 id="page-heading">HELLO WORLD!</h1>
)
@helper oneColumn(Func<dynamic,HelperResult> content) {
<div class="row">
<div class="twelve columns">
@content(null)
</div>
</div>
}
@put.oneColumn( @<h1 id="page-heading">HELLO WORLD!</h1>)
使用@Html.Raw
HTML 帮助程序,或将内容设为IHtmlString
.
@helper oneColumn(string content) {
var contentHtml = new HtmlString(content);
<div class="row">
<div class="twelve columns">
@contentHtml
</div>
</div>
}
@put.oneColumn(
"<h1 id=\"page-heading\">HELLO WORLD!</h1>"
)