<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">taghelpersample</a>
@Html.ActionLink("taghelpersample", "Index", "Home",null, new { Class = "navbar-brand" })
<!--标签助手版form-->
<form asp-controller="Home" asp-action="Index" class="form-horizontal" method="post">
</form>
<!--Html帮助类版form-->
@using (Html.BeginForm("Index", "Home", FormMethod.Post,, new { Class = "form-horizontal" }))
{
}
//类会默认转换为<text-collection></text-collection>
public class TextCollectionTagHelper:TagHelper
{
public override void Process(TagHelperContext context, TagHelperOutput output)
{
base.Process(context, output);
}
}
public string Color { get; set; }
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "div";
output.Attributes.Add("style", "color:" + Color);
var text = "Hello,World";
var h1 = new TagBuilder("h1");
var h2 = new TagBuilder("h2");
var h3 = new TagBuilder("h3");
var h4 = new TagBuilder("h4");
var h5 = new TagBuilder("h5");
var h6 = new TagBuilder("h6");
h1.InnerHtml.Append(text);
h2.InnerHtml.Append(text);
h3.InnerHtml.Append(text);
h4.InnerHtml.Append(text);
h5.InnerHtml.Append(text);
h6.InnerHtml.Append(text);
output.Content.AppendHtml(h1);
output.Content.AppendHtml(h2);
output.Content.AppendHtml(h3);
output.Content.AppendHtml(h4);
output.Content.AppendHtml(h5);
output.Content.AppendHtml(h6);
}
@addTagHelper *,taghelpersample
<text-collection color="red"></text-collection> <text-collection color="blue"></text-collection> <text-collection color="#666"></text-collection>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有