标签:microsoft lse RoCE out public summary mail code ret
代码:
using Microsoft.AspNetCore.Razor.TagHelpers; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace NetCoreTestMVC2.Commons { //public class EmailTagHelper : TagHelper //{ // 示例1:<email mail-to="xxx@qq.com"></email> // public string MailTo { get; set; } // public override void Process(TagHelperContext context, TagHelperOutput output) // { // output.TagName = "a"; // output.Attributes.SetAttribute("href",$"mailto:{MailTo}"); // output.Content.SetContent(MailTo); // } // 示例2:<email>xxx@qq.com</email> // public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) // { // output.TagName = "a"; // var content = await output.GetChildContentAsync(); // var target = content.GetContent(); // output.Attributes.SetAttribute("href", $"mailto:{target}"); // output.Content.SetContent(target); // } //} //[HtmlTargetElement(Attributes = "bold")] //[HtmlTargetElement("bold")] //public class BoldTagHelper : TagHelper //{ // //示例:<p bold>xxx</p> 或者 <bold>xxx</bold> // public override void Process(TagHelperContext context, TagHelperOutput output) // { // output.Attributes.RemoveAll("bold"); // output.PreContent.SetHtmlContent("<strong>"); // output.PostContent.SetHtmlContent("</strong>"); // } //} /// <summary> /// 条件 TagHelper /// <div condition="_SignInManager.IsSignIn(User)">xxx</div> /// 如果 condition 中返回的值是 false 则不会显示 div /// </summary> //public class ConditionTagHelper : TagHelper //{ // public bool Condition { get; set; } // public override void Process(TagHelperContext context, TagHelperOutput output) // { // if (!Condition) // { // output.SuppressOutput(); // } // } //} //前端使用TagHelper前缀,@tagHelperPrefix "tagpre:" //TagHelper 前缀,使用在标签前加上<tagpre:a>xxx</tagpre:a> }
标签:microsoft lse RoCE out public summary mail code ret
原文地址:https://www.cnblogs.com/xsj1989/p/13851473.html