我一直在尝试遵循https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/authoring?view=aspnetcore-2.1来让标签助手工作,但无论如何我确实在智能感知中无法识别它们,在生成 html 的代码中没有断点,并且元素没有转换。这是我的 EmailTagHelper.csusing System;using System.Collections.Generic;using System.Linq;using System.Threading.Tasks;using Microsoft.AspNetCore.Razor.TagHelpers;namespace eHealthy.TagHelpers{ public class EmailTagHelper : TagHelper { public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "a"; // Replaces <email> with <a> tag } }}这是我的 _ViewImports.cshtml@using Microsoft.AspNetCore.Identity@using eHealthy.Models@using eHealthy.Models.AccountViewModels@using eHealthy.Models.ManageViewModels@using eHealthy.Helpers;@using eHealthy.TagHelpers;@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"@addTagHelper "*, eHealthy.TagHelpers"这是我尝试调用助手的页面@model EditViewModel@{ ViewBag.Title = "title"; Layout = "_Layout";}@*<h2>title</h2>*@<form method="post"> <email> potato </email></form><input type="hidden"/>
1 回答
杨__羊羊
TA贡献1943条经验 获得超7个赞
取消引用您添加的标签助手。删除 eHealthy.TagHelpers 助手,您甚至不需要创建它。
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
- 1 回答
- 0 关注
- 194 浏览
添加回答
举报
0/150
提交
取消